Skip to content

Merged command-line argument parser module for Python

License

Notifications You must be signed in to change notification settings

urbanware-org/clap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Clap

Table of contents


Definition

The Clap module is an easy-to-use command-line argument parser for Python projects.

Top

Details

Current versions of Python provide the ArgumentParser module to parse command-line arguments. However, older versions (such as Python 2.6 and below) only contain the deprecated OptionParser module.

The Clap project merges both parsers in a single module with less configuration effort, using ArgumentParser as default and OptionParser as fallback.

The current version of Clap provides a parser object which can parse arguments...

  • that expect a single user-defined value (such as a number, string or path).
  • that expect a certain value (from a predefined list of options).
  • that do not expect anything, but return a Boolean value (e. g. to set a variable to True when given).

Top

Requirements

In order to run the latest version of Clap, the Python 3.x framework (version 3.2 or higher is recommended) must be installed on the system.

Version 1.1.11 is the last release that officially supports the Python 2.x framework.

If you need a later version for the Python 2.x framework for whatever reason, you can try refactoring the syntax from Python 3.x to version 2.x using the 3to2 tool.

However, there is no guarantee that this works properly or at all.

Top

Documentation

For fundamental documentation as well as some usage examples you may have a look at the usage.txt file.

Top

Contact

Any suggestions, questions, bugs to report or feedback to give?

You can contact me by sending an email to [email protected] or by opening a GitHub issue (which I would prefer if you have a GitHub account).

Top

Useless facts

  • The project name is an abbreviation for Command Line Agrument Parser.
  • The first version uploaded on GitHub was Clap 1.1.8 built on January 15th, 2015.
  • The module for Python 3 was initially created by converting the Python 2 module using the 2to3 tool. However, both files are identical except for the shebang.

Top