argument_parser

Provides a complex command-line parser


Keywords
library, command-line, arguments, switches, parsing
License
MIT
Install
nimble install argument_parser

Documentation

Argument parser readme

The Nim programming language provides the parseopt module to parse options from the command line. I found this module lacking, used to python modules like optparse or argparse. This module tries to provide similar functionality to prevent you from writing command line parsing and let you concentrate on providing the best possible experience for your users.

Alternatives to this module are:

This project was originally by gradha, but I (Xe) have taken it over as gradha had marked this project dead.

License

MIT license.

Installation

Stable version

Install the Nim compiler. Use Nim's Nimble package manager to install the module:

$ nimble update
$ nimble install argument_parser

Development version

Install the Nim compiler. Use Nim's Nimble package manager to install locally the github checkout:

$ git clone https://github.com/gradha/argument_parser.git
$ cd argument_parser
$ nimble install -y

If you don't mind downloading the git repository every time, you can also tell Nimble to install the latest development version directly from git:

$ nimble update
$ nimble install -y argument_parser@#head

Documentation

Once you have installed argument_parser you can just import argument_parser in your programs and use its API. The argument_parser module comes with embedded docstrings. You can run nake doc to generate the HTML along with other documents, which are referenced from the generated theindex.html file. Here is an example on how to build the HTML on Unix:

$ cd `nimble path argument_parser`
$ nake doc
$ open theindex.html

The generated documentation for all public versions can also be found at http://gradha.github.io/argument_parser/. No guarantees on its freshness, though, do check the generation date at the bottom.

In the distant future, when most features are complete, a tutorial will be provided to explain how to use the module. In the meantime you should read the examples provided in the examples subdirectory. These examples try to show how to implement common usage patterns for different types of command line parsing.

Changes

This is development version 0.4.3. For a list of changes see the docs/changes.rst file.

Git branches

This project uses the git-flow branching model with reversed defaults. Stable releases are tracked in the stable branch. Development happens in the default master branch.

Feedback

You can send me feedback through github's issue tracker. I also take a look from time to time to Nim's forums where you can talk to other Nim programmers.