Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 20 days 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 (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-06-27T17:46:58.000Z (over 11 years ago)
- Last Synced: 2023-03-10T19:25:51.410Z (over 1 year ago)
- Language: C++
- Size: 109 KB
- Stars: 1
- Watchers: 1
- 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: 12Requirements
============- 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.