Commit 5a7585026db3d5232affe2578ca3b52126bc9e09
Merge branch 'master' of github.com:jarro2783/cxxopts
Showing
1 changed file
with
14 additions
and
6 deletions
README renamed to README.md
| 1 | -== Quick start == | |
| 1 | +# Quick start | |
| 2 | 2 | |
| 3 | 3 | This is a lightweight C++ option parser library, supporting the standard GNU |
| 4 | 4 | style syntax for options. |
| ... | ... | @@ -16,7 +16,7 @@ where c takes an argument, but a and b do not. |
| 16 | 16 | |
| 17 | 17 | Additionally, anything after `--` will be parsed as a positional argument. |
| 18 | 18 | |
| 19 | -How to use: | |
| 19 | +## Basics | |
| 20 | 20 | |
| 21 | 21 | #include <cxxopts.hpp> |
| 22 | 22 | |
| ... | ... | @@ -38,7 +38,7 @@ To parse the command line do: |
| 38 | 38 | |
| 39 | 39 | options.parse(argc, argv); |
| 40 | 40 | |
| 41 | -To retrieve an option use options.count("option") to get the number of times | |
| 41 | +To retrieve an option use `options.count("option")` to get the number of times | |
| 42 | 42 | it appeared, and |
| 43 | 43 | |
| 44 | 44 | options["opt"].as<type>() |
| ... | ... | @@ -46,17 +46,25 @@ it appeared, and |
| 46 | 46 | to get its value. If "opt" doesn't exist, or isn't of the right type, then an |
| 47 | 47 | exception will be thrown. |
| 48 | 48 | |
| 49 | -== Linking == | |
| 49 | +## Positional Arguments | |
| 50 | + | |
| 51 | +Positional arguments can be optionally parsed into one or more options. To set up positional arguments, call | |
| 52 | + | |
| 53 | + options.parse_positional({"first", "second", "last"}) | |
| 54 | + | |
| 55 | +where "last" should be the name of an option with a container type, and the others should have a single value. | |
| 56 | + | |
| 57 | +# Linking | |
| 50 | 58 | |
| 51 | 59 | This is a header only library. |
| 52 | 60 | |
| 53 | -== Requirements == | |
| 61 | +# Requirements | |
| 54 | 62 | |
| 55 | 63 | The only build requirement is a C++ compiler that supports C++11 regular |
| 56 | 64 | expressions. For example GCC >= 4.9 or clang with libc++. |
| 57 | 65 | |
| 58 | 66 | |
| 59 | -== TODO list == | |
| 67 | +# TODO list | |
| 60 | 68 | |
| 61 | 69 | * Allow unrecognised options. |
| 62 | 70 | * Various help strings. | ... | ... |