google / google/python-fire

Docs don't mention when a class method is considered private v.s public / --help behavior is confusing

未關閉
#531 2 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Python
星號
28.2k
分支
1.5k
PR 合併指標
30 天內沒有已合併 PR

描述

Here's a MWE:

```python
#!/usr/bin/env python

from fire import Fire

class Example:
def version(self):
return "bla"
def start(self):
print("starting")
def stop(self):
print("stopping")

Fire(Example)
```

Running this script without arguments shows the available commands - OK:

```
NAME
fire-bug.py

SYNOPSIS
fire-bug.py COMMAND

COMMANDS
COMMAND is one of the following:

start

stop

version
```

But the more common (and usually safe) thing to do when a user is being introduced a new command, is to run it with a `--help`. However, `Fire` doesn't behave the same for this argument:

```
INFO: Showing help with the command 'fire-bug.py -- --help'.

NAME
fire-bug.py

SYNOPSIS
fire-bug.py -
```

Unless you use `--verbose` as well. Why is that? This is not trivial for a user to guess, and only reading the docs here led me to this conclusion. Plus, the docs don't mention how to make a class method a "public" method...

貢獻指南

開啟貢獻指南

研究方向

從 issue 中的 Python Fire MWE 開始,比較其中描述的無參數、使用 --help 以及使用 --verbose 時的行為。更新相關文件,說明類別方法何時會以 public 或 private 的形式公開,以及為什麼這些 --help 呼叫的行為不同。當新貢獻者能夠判斷如何將方法設為 public,並理解文件中所述的 --help 行為時,即表示完成。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
python
領域
cli, documentation
Issue 類型
文件
難度
2/5
預估耗時
1-3 小時
活躍度
停滯
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。