【发布时间】:2018-08-28 20:47:01
【问题描述】:
是否有用于执行 gem/git-style 命令行参数的 Python 模块?我所说的 gem/git 风格是:
$ ./MyApp.py
The most commonly used MyApp commands are:
add Add file contents to the index
bisect Find by binary search the change that introduced a bug
branch List, create, or delete branches
checkout Checkout a branch or paths to the working tree
...
$ ./MyApp.py branch
* current-branch
master
没有参数,输出告诉你如何继续。还有一个特殊的“帮助”命令:
$ ./MyApp.py help branch
这将为您提供有关“分支”命令的更深入提示。
编辑: 做我的意思是它会为您打印使用情况,以无效输入退出,根据您的 CLI 规范运行您的函数。类似于命令行的“URL 映射器”。
【问题讨论】:
标签: python command-line-interface