从词典中产生的指令线
clg的Python项目详细描述
此模块是argparse模块的包装。其目标是生成 来自格式化字典的自定义和高级命令行像Python一样 措辞很容易导出到配置文件(如yaml或json)。 其思想是将命令行定义外包给一个文件,而不是 写几十或几百行代码。
代码在Github(http://github.com/fmenabe/python-clg)上可用
文档在readthedocs(https://clg.readthedocs.org/en/latest/)上提供。
发行说明
2.3.1(2017-01-19)
2.3.0(2016-10-20)
- Add subparsers after args and options for improved behaviour (4c4471c).
- Add a ‘-p/–page’ option to the ^{tt1}$ command (added by the add_help_cmd parameter) allowing to page the output (8b2d9fd).
- Remove obsolete script for generating bash and zsh completion (b7a06fb).
- Fix a bug that prevented the completion (using argcomplete) to work when ^{tt2}$ is used (d2590f7).
- Fix a bug that prevented paging of the help (behaviour induced by the page_help parameter) when the ^{tt1}$ option was not defined manually (0a1a0b4).
- Add the ^{tt4}$ parameter for options and arguments allowing to manage argcomplete completers (20c8461).
- Update documentation for argcomplete (66ad52a).
2.2.0(2016-06-09)
- Add a ^{tt5}$ parameter for parsers allowing to redefine how negatives values are distinguished from options (4c7e7be).
2.1.1(2016-05-08)
- ^{tt2}$ parameter is not anymore a root parameter but a per command parameter and simulate the use of the –help option if no arguments are supplied (6bee4d9). This allows flexibiliy for (sub)commands that do not require any input.
2.1.0(2016-05-08)
- Remove empty list for default value when ^{tt7}$ is set to * or + (4102816).
- Allows to add custom actions by updating ^{tt8}$ dictionnary (65d7480).
- Add a ^{tt9}$ action allowing to page help (818383b, f788f35).
- Add the parameter ^{tt9}$ at the root of the configuration allowing to page the help of all commands (by replacing the default ^{tt1}$ action by the ^{tt9}$ action; 9454f7a).
- Add the parameter ^{tt2}$ at the root of the configuration allowing to print help when no arguments is set (also work for subcommands; 5ea6fe8)
2.0.0(2015-06-25)
- Change behaviour of groups: groups now act like parsers rather than just referencing previously defined options. It breaks files used by previous versions.
- Update design and correct bugs of the ^{tt1}$ command added by the add_help_cmd keyword.
- Improve control of abbrevations behaviour. When ^{tt15}$ parameter was activate, it was not possible to concatenate single options or split with an ‘=’ long options. This is now the case.
- Correct a bug with YAML anchors which causes loss of informations (like the short option).
1.1.1(2015-02-24)
- Correct a bug when using ^{tt16}$ action.
1.1(2015-02-17)
- Add a ^{tt16}$ keyword for options, allowing to use ^{tt16}$ action.
- Allow an option ^{tt19}$ in the root of the configuration that automatically add a ^{tt1}$ command that show the arborescence of all commands with their descriptions.
- Allow the use of ^{tt21}$ with ^{tt22}$ “builtin”.
- Replace the “builtins” __CHOICES__, __MATCH__ and __FILE__ in the help message by the respectives values of those keywords.
- Add the parameter ^{tt15}$ in parser configuration, controlling abbrevations behaviour (http://bugs.python.org/issue14910).
1.0(2014-10-28)
- Rewrite module for matching at best ^{tt24}$.
- Allow bultins.
- Drop compatibility to python2.6 (because of dict comprehension).
0.5(2013-11-25)
- Port code to Python 3 (with compatiblity at least until Python 2.6).
0.4(2013-11-14)
- Add description of parser (via desc keyword).
0.3(2013-08-09)
- Add an iterable and accessible namespace for arguments.
- Change behaviour of parse method (now return a namespace with arguments).
- Set the default value for list type to an empty list.
- Changes the behaviour of the execution of an external module. It is no longer a python path of a module in ‘sys.path’ but directly the path of a file. In addition, keyword ‘lib’ has be replaced by ‘path’.
- Replace ‘__FILE__’ in the default value of an option by the directory of the program.
- Update the license to MIT.
0.2(2013-07-21)
- CommandLine object doesn’t take anymore a JSON or YAML file but a dictionary.
- Add documentation.
- Updating setup for PyPi.