Skip to main content

Command-line generator from a dictionary.

Project description

License Versions PyPi Code repo Documentation Code Health Downloads

This module is a wrapper to argparse module. Its goal is to generate a custom and advanced command-line from a formatted dictionary. As python dictionnaries are easily exportable to configuration files (like YAML or JSON), the idea is to outsource the command-line definition to a file instead of writing dozens or hundreds lines of code.

Code is available on Github (http://github.com/fmenabe/python-clg).

Documentation is available on readthedocs (https://clg.readthedocs.org/en/latest/).

Releases notes

2.1.1 (2016-05-08)

  • print_help parameter is not anymore a root parameter but a per command parameter and simulate the use of the –help option if not 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 nargs is set to * or + (4102816).

  • Allows to add custom actions by updating ACTIONS dictionnary (65d7480).

  • Add a page_help action allowing to page help (818383b, f788f35).

  • Add the parameter page_help at the root of the configuration allowing to page the help of all commands (by replacing the default help action by the page_help action; 9454f7a).

  • Add the parameter print_help 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 help command added by the add_help_cmd keyword.

  • Improve control of abbrevations behaviour. When allow_abbrev 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 version action.

1.1 (2015-02-17)

  • Add a version keyword for options, allowing to use version action.

  • Allow an option add_help_cmd in the root of the configuration that automatically add a help command that show the arborescence of all commands with their descriptions.

  • Allow the use of argparse.SUPPRESS with __SUPPRESS__ “builtin”.

  • Replace the “builtins” __CHOICES__, __MATCH__ and __FILE__ in the help message by the respectives values of those keywords.

  • Add the parameter allow_abbrev in parser configuration, controlling abbrevations behaviour (http://bugs.python.org/issue14910).

1.0 (2014-10-28)

  • Rewrite module for matching at best argparse.

  • 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

clg-2.1.1.tar.gz (12.2 kB view details)

Uploaded Source

File details

Details for the file clg-2.1.1.tar.gz.

File metadata

  • Download URL: clg-2.1.1.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for clg-2.1.1.tar.gz
Algorithm Hash digest
SHA256 a05cc74c13f899ab7107bac548e505eb914853e0d485bb002d5d5a3cda624a90
MD5 904f6c21e8e1de4a6d5d50e9a5dfc0c1
BLAKE2b-256 e7371df716ce7fd6b734e524abbaf8a86fa821f34dfb13d5da72a302e8ee821d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page