google / google/python-fire

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

Đang mở
#258 1 bình luận 2 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
28.2k
Fork
1.5k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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!

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.