google / google/python-fire

Behaviour of fire for variadic arguments

Đang mở
#169 22 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ả

I have some codebase which uses argparse and wanted to migrate into python-fire. Now there I have option of specifying nargs as different flags to get required arguments. Now say I have one flag which uses '+' and one uses '*' to get arguments. How can I wrap all this stuff in a function so that fire converts into desired cli automatically. Actually I want to get variable size list for different flags.
Consider this testfire.py
```
def special(*args, **kwargs):
print(args)
print(kwargs)
```
python testfire.py special --par1 haha --par2 a b c
produces:
```
('b', 'c')
{'par1': 'haha', 'par2': 'a'}
```
I would like to achieve is that to be able to have these name of par1 and par2 integrated and for par2 I want to get a, b, c in list.
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.