Skip to content

Commit

Permalink
Update documentation / remove redundancy
Browse files Browse the repository at this point in the history
  • Loading branch information
weisslj committed Dec 20, 2015
1 parent e4d949e commit ff68987
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 68 deletions.
3 changes: 1 addition & 2 deletions OptionParser.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/**
* Copyright (C) 2010 Johannes Weißl <[email protected]>
* License: MIT License
*
* See OptionParser.h for help.
* URL: https://github.com/weisslj/cpp-optparse
*/

#include "OptionParser.h"
Expand Down
55 changes: 1 addition & 54 deletions OptionParser.h
Original file line number Diff line number Diff line change
@@ -1,60 +1,7 @@
/**
* Copyright (C) 2010 Johannes Weißl <[email protected]>
* License: MIT License
*
* git clone http://github.com/weisslj/cpp-optparse.git
*
* This is yet another option parser for C++. It is modelled after the
* excellent Python optparse API. Although incomplete, anyone familiar to
* optparse should feel at home:
* http://docs.python.org/library/optparse.html
*
* Design decisions:
* - elegant and easy usage more important than speed / flexibility
* - shortness more important than feature completeness
* * no unicode
* * no checking for user programming errors
*
* Why not use getopt/getopt_long?
* - not C++ / not completely POSIX
* - too cumbersome to use, would need lot of additional code
*
* Why not use Boost.Program_options?
* - boost not installed on all target platforms (esp. cluster, HPC, ...)
* - too big to include just for option handling:
* 322 *.h (44750 lines) + 7 *.cpp (2078 lines)
*
* Why not use tclap/Opag/Options/CmdLine/Anyoption/Argument_helper/...?
* - no reason, writing one is faster than code inspection :-)
* - similarity to Python desired for faster learning curve
*
* Future work:
* - nargs > 1?
* - comments?
*
* Python only features:
* - conflict handlers
* - adding new actions
*
*
* Example:
*
* using optparse::OptionParser;
*
* OptionParser parser = OptionParser() .description("just an example");
*
* parser.add_option("-f", "--file") .dest("filename")
* .help("write report to FILE") .metavar("FILE");
* parser.add_option("-q", "--quiet")
* .action("store_false") .dest("verbose") .set_default("1")
* .help("don't print status messages to stdout");
*
* optparse::Values options = parser.parse_args(argc, argv);
* vector<string> args = parser.args();
*
* if (options.get("verbose"))
* cout << options["filename"] << endl;
*
* URL: https://github.com/weisslj/cpp-optparse
*/

#ifndef OPTIONPARSER_H_
Expand Down
25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,28 @@ Python optparse API. Although incomplete, anyone familiar to

## Design decisions

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

## FAQ

- Why not use getopt/getopt_long?
* not C++ / not completely POSIX
* too cumbersome to use, would need lot of additional code
* Not C++ / not completely POSIX
* Too cumbersome to use, would need lot of additional code
- Why not use Boost.Program_options?
* boost not installed on all target platforms (esp. cluster, HPC, ...)
* too big to include just for option handling:
* Boost not installed on all target platforms (esp. cluster, HPC, ...)
* Too big to include just for option handling for many projects:
322 *.h (44750 lines) + 7 *.cpp (2078 lines)
- Why not use tclap/Opag/Options/CmdLine/Anyoption/Argument_helper/...?
* no reason, writing one is faster than code inspection :-)
* similarity to Python desired for faster learning curve
* Similarity to Python desired for faster learning curve

## Future work
- nargs > 1?
- comments?

- Support nargs > 1?

## Example

Expand Down

0 comments on commit ff68987

Please sign in to comment.