Commit Graph

13 Commits

Author SHA1 Message Date
Pranav Srinivas Kumar
716ec60291 Added flag() shorthand function 2023-10-27 16:37:20 -05:00
Pranav Srinivas Kumar
9bb553b882 #277 Added in-built support for string_type choices 2023-10-27 09:16:25 -05:00
Christoph Hindermann
6c4bddb990 CMakefile: Use -Wpedantic, -Werror and -Wextra for compilation in gcc. Fixed warnings 2023-10-20 19:57:12 +02:00
Arthur LAURENT
6723c81877
update test to use module when WITH_MODULE macro is set 2023-10-15 18:51:56 +02:00
Fanurs
e82653c2d9 Fixed test for multiline help message alignment 2023-04-22 19:23:17 -04:00
Fanurs
19d85eadb0 Passed test for multiline help message alignment 2023-04-22 15:16:47 -04:00
Pranav Srinivas Kumar
6c7da857b6 Added table of contents to README and clang formatted code 2022-09-20 20:27:24 -07:00
Sean Robinson
ea1f7ef663 Allow removal of default arguments (i.e. --help and --version)
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 #119
Closes #138
Closes #139

Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2021-10-27 09:02:33 -07:00
Mike Zozu
4de9f89b59 add tests for repr() and extend tests for help msg 2020-12-15 19:05:18 +03:00
Pranav Srinivas Kumar
33101e7972 Closes #73 2020-05-08 14:35:05 -05:00
Zhihao Yuan
77f3bd9b8d
Default --help to print help and exit
The change also fixes a rare bug introduced in 9007958:
when there are duplicated keys, insert_or_update overrides
previously inserted ones, emplace doesn't.

fixes: p-ranav/argparse#59
2019-11-22 16:54:58 -06:00
Zhihao Yuan
1af8b826c8
Annotate test cases with doctest::test_suite
This change also explicitly lists the source files
for CMake.  This is because `GLOB` does not remove
old files when switching branches in Git, and
`CONFIGURE_DEPENDS` will add unstaged files after
stashing.

See also: https://cmake.org/cmake/help/latest/command/file.html#glob
2019-11-21 14:24:50 -06:00
Pranav Srinivas Kumar
f9ab33d1a6 Closes #53 2019-11-21 09:08:49 -06:00