arg, a C++ command-line parser
--- simplicity is the goal
latest release: arg-1.0 (2010-05-07)

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 http://ccdw.org/~cjj/prog/arg/src/.

Contact

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


Chun-Chung Chen | Programs

Licensed under LGPL Valid HTML 4.01 Strict