File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ # cppcommandline
2+
3+ Command line parser for C++11 and later using the fluid interface.
4+
5+ # features
6+
7+ - fluid interface
8+ - short and long names for options
9+ - positional arguments
10+ - value bindings
11+ - default values
12+ - required options
13+ - option descriptions
14+ - application name extraction
15+ - automatic help
16+ - error handling using standard exceptions
17+
18+ # usage
19+
20+ ```
21+ #include <cppcommandline.h>
22+
23+ int main(int argc, char **argv)
24+ {
25+ cppcommandline::Parser commandLine;
26+
27+ std::string filename;
28+ int someoption = 0;
29+ bool flag = false;
30+
31+ commandLine.option().withDescription("A required filename").required().bindTo(filename); //positional
32+ commandLine.option("someoption").asShortName("s").withDefaultValue(10).withDescription("My description of someoption").bindTo(someoption);
33+ commandLine.option("flag").withDefaultValue(false).withDescription("My flag").bindTo(flag);
34+ commandLine.parse(argc, argv);
35+
36+ return 0;
37+ }
38+ ```
You can’t perform that action at this time.
0 commit comments