google / google/python-fire

--help doesn't work on functions with **kwargs and all default args

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

描述

Consider the following example:

```
import fire

def test(a=1, b=1):
"""
Returns the sum of a and b.

:param a: The first parameter
:param b: The second parameter
"""
return a + b

fire.Fire(test)
```

If the file is called using `python ./myFile.py --help`, the help signature is printed as expected

However, if `**kwargs` is added to the signature of `test`, the return value of the function is printed instead. Is this expected behavior? It works if I run `python ./myFile.py -- --help`, but for someone using my application and not familiar with the 'fire' CLI, this is non-intuitive.

How do I need to modify `test` so that if someone calls `--help` on it, the help signature is printed?

Thanks!

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

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

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