Clap module


Contents:

Definition

What is Clap?

First of all, it is a Python module, not a standalone project. Therefore, it most probably is useful for developers, only. The module can be integrated in software projects for certain purposes.



Details

Further information about the module.

Python poweredThe Clap module is project as well as platform independent. In first place, it has been developed to satisfy the needs of the projects provided by this website. Its name is an abbreviation of Command Line Argument Parser.


Before, there was some code for parsing the command-line arguments using an ArgumentParser object in every script. Furthermore, there was some code to handle the arguments with an OptionParser object as a fallback, in case the argparse module is not installed or available. This worked fine so far, but there was quite some code inside each of these scripts.

Due to this, the code to check for an argument parser module and the main argument parser code has been exported from all the scripts and merged in a single project independent module which every script can use. In some cases it saved more than a hundred lines of code per project.

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


Download

Download the project.

GitHub logoDownloads and further information can be found on GitHub.