From 0889c3ccb30a29467e4ed02bcf06ba9c20a680f2 Mon Sep 17 00:00:00 2001 From: Christian Lang Date: Mon, 17 Jun 2019 14:16:55 +0200 Subject: [PATCH] Improve various documentation parts --- README.md | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index fa2bce5..22ac515 100644 --- a/README.md +++ b/README.md @@ -131,6 +131,35 @@ This is a header only library. The only build requirement is a C++ compiler that supports C++11 regular expressions. For example GCC >= 4.9 or clang with libc++. +# Details + +## Unknown options + +In default mode all passed options to the CLI needs to be defined. Else an `option_not_exists_exception` +is thrown. This behavior can be disabled by allowing unrecognised options: + +~~~ +options.allow_unrecognised_options() +~~~ + +## Processing/Consuming of options + +The command to parse the CLI arguments that usually looks similar to: + +~~~ +options.parse(argc, argv); +~~~ + +Does not only read `argc` and `argv` but also does manipulate the array behind those variables. +There are different parts of this behavior: + +* All arguments that are recognized are consumed and therefore removed from the C-string array. +* All consumed arguments can be retrieved by: `result.arguments();` +* The only element in the array that is always preserved is + the `argv[0]` which represents the program name. +* In default mode all passed arguments have to be consumed. + See `allow_unrecognised_options()` to disable this behavior. + # TODO list -* Allow unrecognised options. +* None