带argparse的脚本的自动参数完成。

auto-argcomplete的Python项目详细描述


https://img.shields.io/pypi/v/auto-argcomplete.svg

auto-argcomplete是脚本的自动外壳完成生成器 使用argparse。

行为如下:

$ python example/simple_script.py <TAB>
$ python example/simple_script.py --
--dry-run   --help      --kick-off  --module

如果您使用的是zsh:

% python example/simple_script.py --
--dry-run   -- display what to do
--help      -- show this help message and exit
--module    -- specify module name
--kick-off

example/simple_script.py是:

importargparseparser=argparse.ArgumentParser()parser.add_argument('-m','--module',help='specify module name')parser.add_argument('-n','--dry-run',help='display what to do')parser.add_argument('-k','--kick-off')parser.parse_args()

nothing导入脚本!:微笑:

auto-argcomplete可以自动理解--help选项的输出, 因此automatically支持所有使用argparse的脚本。

安装

$ pip install auto-argcomplete

测试

$ nosetests -v auto_argcomplete
热门话题
java为什么相机的实时预览旋转90度?   java为什么我的安卓notification没有出现?   Java在ArrayList中循环以扫描匹配值   使用Apache HTTPClient的java“cURL u”API密钥授权   java weblogic需要配置war文件部署   java如何在条目顺序不断变化时比较两个JSON字符串   java JAXB是否将未定义的元素解组以映射?   java如何防止通过控制台输入优先于禁用按钮?   java使用两个JCalender实现SWT应用   java有一种调用JTextField的方法。没有激发DocumentListener的removeupdate()的setText()?   java Spring启动应用程序执行器端点得到注册,请求仍然失败   集合按对象Java流分组   java SpringBoot:EclipseLink与H2   java有没有一种方法可以代替IntelliJ上的run按钮来执行命令行   java与Executor服务在D语言中的等价物?   java系统。出来打印不显示ArrayList<Object>   java字符串不包含格式说明符   HDF5Java。HDFView中的lang.UnsatifiedLinkError   java片段未显示在Android导航组件中   java如何迭代包含arraylist的Hashmap