Commit 31b77f11af2bbf634a53e2828c3987777d22c2ab

Authored by Jarryd Beck
1 parent fedf9d7b

Prepare notes for v3

Showing 2 changed files with 43 additions and 1 deletions
CHANGELOG.md
... ... @@ -3,7 +3,7 @@
3 3 This is the changelog for `cxxopts`, a C++11 library for parsing command line
4 4 options. The project adheres to semantic versioning.
5 5  
6   -## Next version
  6 +## 3.0
7 7  
8 8 ### Changed
9 9  
... ... @@ -13,6 +13,12 @@ options. The project adheres to semantic versioning.
13 13 * Add `CXXOPTS_NO_EXCEPTIONS` to disable exceptions.
14 14 * Fix char parsing for space and check for length.
15 15 * Change argument type in `Options::parse` from `char**` to `const char**`.
  16 +* Refactor parser to not change its arguments.
  17 +* `ParseResult` doesn't depend on a reference to the parser.
  18 +
  19 +### Added
  20 +
  21 +* A list of unmatched arguments is available in `ParseResult`.
16 22  
17 23 ## 2.2
18 24  
... ...
README.md
... ... @@ -5,6 +5,25 @@
5 5 Note that `master` is generally a work in progress, and you probably want to use a
6 6 tagged release version.
7 7  
  8 +## Version 3 breaking changes
  9 +
  10 +If you have used version 2, there are a couple of breaking changes in version 3
  11 +that you should be aware of. If you are new to `cxxopts` you can skip this
  12 +section.
  13 +
  14 +The parser no longer modifies its arguments, so you can pass a const `argc` and
  15 +`argv` and expect them not to be changed.
  16 +
  17 +The `ParseResult` object no longer depends on the parser. So it can be returned
  18 +from a scope outside the parser and still work. Now that the inputs are not
  19 +modified, `ParseResult` stores a list of the unmatched arguments. These are
  20 +retrieved like follows:
  21 +
  22 +```cpp
  23 +auto result = options.parse(argc, argv);
  24 +result.unmatched(); // get the unmatched arguments
  25 +```
  26 +
8 27 # Quick start
9 28  
10 29 This is a lightweight C++ option parser library, supporting the standard GNU
... ... @@ -69,6 +88,23 @@ exception will be thrown.
69 88 Note that the result of `options.parse` should only be used as long as the
70 89 `options` object that created it is in scope.
71 90  
  91 +## Unrecognised arguments
  92 +
  93 +You can allow unrecognised arguments to be skipped. This applies to both
  94 +positional arguments that are not parsed into another option, and `--`
  95 +arguments that do not match an argument that you specify. This is done by
  96 +calling:
  97 +
  98 +```cpp
  99 +options.allow_unrecognised_options();
  100 +```
  101 +
  102 +and in the result object they are retrieved with:
  103 +
  104 +```cpp
  105 +result.unmatched()
  106 +```
  107 +
72 108 ## Exceptions
73 109  
74 110 Exceptional situations throw C++ exceptions. There are two types of
... ...