https://github.com/hughperkins/cppsimpleargsparser
Simple C++ args parser. Easy to use. Automatically provides checking and usage printout.
https://github.com/hughperkins/cppsimpleargsparser
Last synced: 7 months ago
JSON representation
Simple C++ args parser. Easy to use. Automatically provides checking and usage printout.
- Host: GitHub
- URL: https://github.com/hughperkins/cppsimpleargsparser
- Owner: hughperkins
- Created: 2013-06-27T17:34:55.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2013-06-27T17:46:58.000Z (almost 13 years ago)
- Last Synced: 2025-02-06T02:47:21.894Z (about 1 year ago)
- Language: C++
- Size: 109 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
cppsimpleargsparser
===================
Simple C++ args parser. Easy to use. Automatically provides checking and usage printout.
Let's say we want to accept three integers on our commandline: n, iterations, and threads.
In our program, we put:
#include "args.h"
int main( int argc, char *argv[] ) {
int n, iterations, threads;
Args( argc, argv ).arg( "n", &n ).arg( "iterations", &iterations ).arg( "threads", &threads ).go();
// that's it!
// rest of program here.
return 0;
}
If we run the program with no arguments, we get:
> ./testArgs
Usage: ./testArgs [n] [iterations] [threads]
We can try this usage:
> ./testArgs 4 3 12
n: 4
iterations: 3
threads: 12
Requirements
============
- C++
- C++ standard library
- nothing else!
License
=======
MPL 2.0
This means you can use it in your own program without needing to
use any special license on your own program. You must keep
the copyright notice on the args.h file, and the license
header.