Skip to content

Commit ff68987

Browse files
committed
Update documentation / remove redundancy
1 parent e4d949e commit ff68987

File tree

3 files changed

+15
-68
lines changed

3 files changed

+15
-68
lines changed

OptionParser.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
/**
22
* Copyright (C) 2010 Johannes Weißl <[email protected]>
33
* License: MIT License
4-
*
5-
* See OptionParser.h for help.
4+
* URL: https://github.com/weisslj/cpp-optparse
65
*/
76

87
#include "OptionParser.h"

OptionParser.h

Lines changed: 1 addition & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,7 @@
11
/**
22
* Copyright (C) 2010 Johannes Weißl <[email protected]>
33
* 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
585
*/
596

607
#ifndef OPTIONPARSER_H_

README.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,28 @@ Python optparse API. Although incomplete, anyone familiar to
99

1010
## Design decisions
1111

12-
- elegant and easy usage more important than speed / flexibility
13-
- shortness more important than feature completeness
14-
* no unicode
15-
* no checking for user programming errors
12+
- Elegant and easy usage more important than speed / flexibility
13+
- Small size more important than feature completeness, e.g.:
14+
* No unicode
15+
* No checking for user programming errors
16+
* No conflict handlers
17+
* No adding of new actions
1618

1719
## FAQ
1820

1921
- Why not use getopt/getopt_long?
20-
* not C++ / not completely POSIX
21-
* too cumbersome to use, would need lot of additional code
22+
* Not C++ / not completely POSIX
23+
* Too cumbersome to use, would need lot of additional code
2224
- 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+
* Boost not installed on all target platforms (esp. cluster, HPC, ...)
26+
* Too big to include just for option handling for many projects:
2527
322 *.h (44750 lines) + 7 *.cpp (2078 lines)
2628
- Why not use tclap/Opag/Options/CmdLine/Anyoption/Argument_helper/...?
27-
* no reason, writing one is faster than code inspection :-)
28-
* similarity to Python desired for faster learning curve
29+
* Similarity to Python desired for faster learning curve
2930

3031
## Future work
31-
- nargs > 1?
32-
- comments?
32+
33+
- Support nargs > 1?
3334

3435
## Example
3536

0 commit comments

Comments
 (0)