#include <arg.hh>
#include <iostream>
int main(int argc, char ** argv)
{
arg::Parser p;
int n;
p.add_opt('n').stow(n);
p.parse(argc, argv);
std::cout << n << '\n';
return 0;
}
Above is a simple example making use of the arg parser. After unpacking the source package, you can find it as “arg_ex0.cc” in the package directory. Without installation, you can test it with the following commands:
$ c++ arg_ex0.cc arg.cc -I. -o arg_ex0 $ ./arg_ex0 -n123 123
For simple applications, simply copy “arg.cc” and “arg.hh” to your program directory then follow the usage demonstrated above.
You can download the source packages from https://ccdw.org/~cjj/prog/arg/src/.
The source is also available on github.
Comments and bug reports are welcome. Please direct them to the author.