当我使用Python的argparse或optparse命令行参数解析器时,参数的任何唯一前缀都被认为是有效的,例如
$ ./buildall.py --help
usage: buildall.py [-h] [-f]
Build all repositories
optional arguments:
-h, --help show this help message and exit
-f, --force Build dirty repositories
Run Code Online (Sandbox Code Playgroud)
作品有--help,--hel,--he的帮助选项,以及--forc与--fo为强制选项.
可以以某种方式关闭此行为吗?我想获得不完整参数的错误消息.