custom prefixes for `argparse.BooleanOptionalAction`
Đang mở
@serhiy-storchaka đang làm issue này rồi.
Từ ngày 23/10/2024.
stdlib
type-feature
- Ngôn ngữ chính
- Python
- Star
- 77.2k
- Fork
- 35.9k
- Chỉ số merge pull request
- Chỉ số pull request đang chờ
Mô tả
Feature or enhancement
Proposal:
At the moment, argparse.BooleanOptionalAction gives e.g. --foo vs --no-foo, whose prefix is hardcoded:
https://github.com/python/cpython/blob/cd516cd1f5e94dba887353f421513fd172efadf3/Lib/argparse.py#L848
https://github.com/python/cpython/blob/cd516cd1f5e94dba887353f421513fd172efadf3/Lib/argparse.py#L863
It would be beneficial if we can change the prefixes of the binary options: e.g. --enable- vs --disable- like autoconf.
usage: [-h] [--enable-foo | --disable-foo]
options:
-h, --help show this help message and exit
--enable-foo, --disable-foo
helpstring for foo
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Đánh giá
Issue này chưa được đánh giá.