arg, a C++ command-line parser
--- simplicity is the goal
latest release: arg-1.2 (2018-06-01)

Example

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

Documentation

Download

You can download the source packages from https://ccdw.org/~cjj/prog/arg/src/.

The source is also available on github.

Contact

Comments and bug reports are welcome. Please direct them to the author.


Chun-Chung Chen | Programs

Licensed under LGPL [HTML 5]