Crate cl_parse

Source
Expand description

§Command Line Parse

cl_parse is a library that allows you to define commandline options and arguments and then parse the commandline arguments based on that definition.

§Motivation

cl_parse was developed to allow the most common commandline options that are used in modern commandline utilities. It was also designed for ease of use. The following are the features implemented in cl_parse.

  • option aliases. e.g. -f, –file
  • options with negative values. e.g. –increment -1
  • flag concatenation. i.e. -xvgf is equivalent to -x -v -g -f
  • Auto usage message generation
  • Auto help message generation
  • -h, –help output provided by default
  • missing value detection for options
  • ability to define required options
  • option and argument validation. i.e. only defined options and arguments can be used
  • unordered options and arguments
  • retrieving the option or argument in the target type. e.g. i32, String, etc.

§Examples

Structs§

CommandLine
Stores the parsed command line
CommandLineDef
Defines the valid commandline options and arguments for this program