Skip to content

brainpower/checkarg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CheckArg
is a lightweight and easy to use command line parser.

It's inspired by ArgumentParser from python,
therefore, if you've used that one before, you'll find this one quite similar.
It is, intentionally, in no way a complete reimplementation or port of the former.

The main goal is for it to be easy to understand and use.
Secondly, its intended to be non-intrusive and lightweight.
Therefore it pulls no 'external' dependencies and relies completely on the STL (C++), Java API or C Standard Library, respectively.

That way it's pretty easy to integrate into an existing project,
because it's non-intrusive, you dont need to 'build your project around it'.

Commandline options use the common so-called GNU style,
e.g. use double dashes and look something like these:

program --option=value --quiet --option2 <value>

Additionally, abreviations of those in so-called POSIX style (or UNIX style) can be added.
They look like this:

program -o <value> -q -f <value>

And they can be combined:

program -o <value> -qf <value>
program -o <value> -qf<value>

Note that above commands are equivalent. This means after a value type option is found in a grouped option the remainder is always considered to be the value, even if you meant it to be an option.
So these commands are not the same:

program -o <value> -qfi other_file
program -o <value> -q -f other_file -i

In the first command, 'i' is considered the value of -f, other_file a positional argument, not the value of either -f or -i. It is discouraged to append the value of an option without a separator like -qifother_file, it creates confusion where none is neccessary. Better be clear and use -qi -f other_file.

In the docs I'll call the GNU style and POSIX style options "long" and "short" options, respectively.

Old style or traditional style options are not supported and I don't plan to do so.
You may convince me otherwise, though.
Old style options (like tar supports) look like this:

tar xfL <value_for_f> <value_for_L>