Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Version flag alongside other commands

オープン
#468 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python
領域
cli

調査の方向性

まず、複数のコマンドを公開する callable を使って Python Fire 0.5.0 で報告された動作を再現し、次にスタンドアロンフラグとコマンドヘルプがどのように組み立てられるかを追跡します。foo --versionfoo -vfoo --helpfoo mycommand myarg を比較します。バージョンフラグが独立して機能し、該当するヘルプ出力に表示され、既存のコマンド動作を変更しなければ完了です。

索引モデルが issue の本文から書いたものです。

説明

I have a script which has multiple commands, each of which have their own arguments etc. I would like to add a simple flag to be used standalone to simply display the version of my script. I would like the the --help display to additionally show users this flag is available without affecting the other commands. For instance if my script is called foo, I'd like to be able to do:

foo --version or foo -v

but I'd still like to do:

foo mycommand myarg etc.

The two closest solutions I've tried each have a downside:

  • the flags and the commands are displayed in different help windows e.g. foo --help shows the help window for the flags whilst foo standlone shows the help window for the commands
  • the help window shows both flags and commands but the flag is interpreted as a flag to the commands such that if I type foo --version, the version is displayed but so is the help window because it thinks a command is missing

I'm using fire==0.5.0. Is there any way I can achieve this?

主要言語
Python
スター
28.2k
フォーク
1.5k
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

google/python-fire のほかの issue

google/python-fire の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。