google / google/python-fire

Unexpected Completion Behavior

Đang mở
#148 5 bình luận 0 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 simple example (from the docs)

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

import fire

def add(x, y):
return x + y

if __name__ == '__main__':
fire.Fire(add, name='./add.py')
```

The first command completion shows `add` and the second immediately `--x --y`.

This is confusing, since I would expect to see `X` and after I entered the first number I would expect `Y` or or even `X Y` at the very beginning so I know I have to enter 2 numbers, especially since the Usage shows

```
Usage: ./add.py X Y
./add.py --x X --y Y
```

As far as I can see it is also not possible to distinguish mandatory from optional arguments. In the case above `X` and `Y`are mandatory and I would not expect to see `--x`and `--y`. An optional argument could e.g. be `--modulo`, which would have a default value if not used, but how to distinguish that in the Python code from the other arguments?

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.