Only those places in the README where an error is explicitly found in the
main function have been updated. Other uses of exit are left untouched as
there is not enough context to know if return will work in that location.
Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
Allows users to opt-out of std::exit call in default arguments without
needing to replace with new --help and --version arguments.
Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
This replaces the verbiage copied from the Python argparse documentation
and makes the code sample more concrete. This illustrates how to avoid the
multiple help output problem reported in #165.
Closes#165
Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
This allows updating attached object properties without holding external
references to the various Argument and ArgumentParser objects.
Closes#227
Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
This allows checking whether user input was processed into the parser
or any attached subparsers.
Closes#212
Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
FetchContent_MakeAvailable was added in CMake v3.14. Also includes
end-of-line whitespace clean-ups.
Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
Help output has changed format over time. This updates the README
example to reflect current practice by running the example code
and copy-pasting its output.
Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
The help and version arguments are still included by default, but which
default arguments to include can be overridden at ArgumentParser creation.
argparse generally copies Python argparse behavior. This includes a
default `--help`/`-h` argument to print a help message and exit. Some
developers using argparse find the automatic exit to be undesirable.
The Python argparse has an opt-out parameter when constructing an
ArgumentParser. Using `add_help=False` avoids adding a default `--help`
argument and allows the developer to implement a custom help.
This commit adds a similar opt-out to our C++ argparse, but keeps the
current behavior as the default. The `--help`/`-h` and `--version`/`-v`
Arguments handle their own output and exit rather than specially treating
them in ArgumentParser::parse_args_internal.
Closes#119Closes#138Closes#139
Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
Previously, only arguments with one or more parameters would run actions.
But, at times it can be useful to run an action when an argument does not
expect any parameters.
Closes#104
Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
These examples give a false impression that a space in the middle of the
application name is well handled. While a space might be possible, it
must be escaped in shells, i.e. a common environment for a CLI argument
parser.
Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
argparse seems to use the "std::" qualifier for std namespace members,
continue that in the documentation.
Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>