使用类型提示为懒人创建命令行界面。
cliz的Python项目详细描述
使用类型提示为懒人创建命令行界面。
快速启动
此代码段:
# ls.pydefls(filename,*,long=False,all=False,human_readable=False,limit:int=None):""" Fake command for listing. :param filename: filename, what else did you expect? :param long: long listing or something :param all: all, like including hidden files dude :param human_readable: show human readable stats :param limit: limit the number of files printed """...
生成此命令行界面:
$ python ls.py --help usage: ls [-h] [-l] [-a] [-H] [-L LIMIT] filenameFake command for listing.positional arguments: filename filename, what else did you expect?optional arguments: -h, --help show this help message and exit -l, --long long listing or something -a, --all all, like including hidden files dude -H, --human-readable show human readable stats -L LIMIT, --limit LIMIT limit the number of files printed
clizy通过使用我们都使用、知道和喜欢的东西简化了命令行界面的创建- 参数名称、默认值、文档字符串和类型提示-没有不必要的复杂性 以及大量的文件。
有兴趣吗?请参阅其他库中的docs和comparison。