|
1 | 1 | /**
|
2 | 2 | * Copyright (C) 2010 Johannes Weißl <[email protected]>
|
3 | 3 | * License: MIT License
|
4 |
| - * |
5 |
| - * git clone http://github.com/weisslj/cpp-optparse.git |
6 |
| - * |
7 |
| - * This is yet another option parser for C++. It is modelled after the |
8 |
| - * excellent Python optparse API. Although incomplete, anyone familiar to |
9 |
| - * optparse should feel at home: |
10 |
| - * http://docs.python.org/library/optparse.html |
11 |
| - * |
12 |
| - * Design decisions: |
13 |
| - * - elegant and easy usage more important than speed / flexibility |
14 |
| - * - shortness more important than feature completeness |
15 |
| - * * no unicode |
16 |
| - * * no checking for user programming errors |
17 |
| - * |
18 |
| - * Why not use getopt/getopt_long? |
19 |
| - * - not C++ / not completely POSIX |
20 |
| - * - too cumbersome to use, would need lot of additional code |
21 |
| - * |
22 |
| - * Why not use Boost.Program_options? |
23 |
| - * - boost not installed on all target platforms (esp. cluster, HPC, ...) |
24 |
| - * - too big to include just for option handling: |
25 |
| - * 322 *.h (44750 lines) + 7 *.cpp (2078 lines) |
26 |
| - * |
27 |
| - * Why not use tclap/Opag/Options/CmdLine/Anyoption/Argument_helper/...? |
28 |
| - * - no reason, writing one is faster than code inspection :-) |
29 |
| - * - similarity to Python desired for faster learning curve |
30 |
| - * |
31 |
| - * Future work: |
32 |
| - * - nargs > 1? |
33 |
| - * - comments? |
34 |
| - * |
35 |
| - * Python only features: |
36 |
| - * - conflict handlers |
37 |
| - * - adding new actions |
38 |
| - * |
39 |
| - * |
40 |
| - * Example: |
41 |
| - * |
42 |
| - * using optparse::OptionParser; |
43 |
| - * |
44 |
| - * OptionParser parser = OptionParser() .description("just an example"); |
45 |
| - * |
46 |
| - * parser.add_option("-f", "--file") .dest("filename") |
47 |
| - * .help("write report to FILE") .metavar("FILE"); |
48 |
| - * parser.add_option("-q", "--quiet") |
49 |
| - * .action("store_false") .dest("verbose") .set_default("1") |
50 |
| - * .help("don't print status messages to stdout"); |
51 |
| - * |
52 |
| - * optparse::Values options = parser.parse_args(argc, argv); |
53 |
| - * vector<string> args = parser.args(); |
54 |
| - * |
55 |
| - * if (options.get("verbose")) |
56 |
| - * cout << options["filename"] << endl; |
57 |
| - * |
| 4 | + * URL: https://github.com/weisslj/cpp-optparse |
58 | 5 | */
|
59 | 6 |
|
60 | 7 | #ifndef OPTIONPARSER_H_
|
|
0 commit comments