Commit Graph

151 Commits

Author SHA1 Message Date
Pranav Srinivas Kumar
6d49d5ee1b Limiting choices support to string type or integer type 2023-10-27 10:35:04 -05:00
Pranav Srinivas Kumar
0b8d0e2426 Added support for integer type in choices 2023-10-27 10:28:54 -05:00
cobyj33
1a7a1dfd43 Change parse_args examples to catch const std::exception instead of std::runtime_error
parse_args can throw exceptions that are not based on std::runtime_error, and the
error message should show on all errors.
2023-10-25 20:33:24 -05:00
cobyj33
90945c5c95 Add to readme FetchContent section to automatically turn off building tests and samples 2023-10-25 19:12:11 -05:00
Pranav
557948f123
Update README.md 2023-03-29 11:54:38 -05:00
Sean Robinson
9377e0d3b2 Use return in place of exit() in README and samples
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>
2023-03-29 08:42:12 -07:00
Sean Robinson
0ae3c7d919 Add exit_on_default_arguments parameter to ArgumentParser
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>
2023-03-22 09:07:45 -07:00
Sean Robinson
04ac1fe366 Refactor Parent Parsers documentation
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>
2023-01-17 13:57:59 -07:00
Sean Robinson
a5ab5b0ce8 Update minimum supported MSVC version
https://learn.microsoft.com/en-us/cpp/overview/visual-cpp-language-conformance?view=msvc-170

Closes #228

Reported-by: @c0rn1ie
Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2023-01-17 13:57:59 -07:00
Sean Robinson
ecba90a4eb Highlight default arguments and their default behavior
Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2022-12-20 09:44:34 -07:00
Sean Robinson
5f22faa973 Add ArgumentParser::at to retrieve arguments and subparsers
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>
2022-11-29 13:43:16 -07:00
Sergey Podobry
8e6a36dd0d Add is_subcommand_used overload
It's useful for removing string literals duplication in a code.
2022-11-08 01:31:45 +02:00
Pranav
ed2953aa3d
Merge pull request #218 from skrobinson/feat-bool-argparser
Allow check if ArgumentParser has parsed values
2022-10-11 17:46:05 -05:00
Sean Robinson
f710bbdacf Add operator bool for ArgumentParser
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>
2022-10-10 15:26:42 -07:00
Sean Robinson
0c83c631c5 Update CMake version in README example for FetchContent
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>
2022-10-06 13:57:34 -07:00
Pranav Srinivas Kumar
997da92556 Bumped version to v2.9 2022-09-21 19:24:04 -07:00
Pranav
d6c3f3b704
Updated cmake command for building samples 2022-09-21 21:17:24 -05:00
Pranav Srinivas Kumar
6f1e89885e Added nargs to help output, added test samples 2022-09-21 18:48:11 -07:00
Pranav Srinivas Kumar
3b9df0b1e7 Added support for metavar and improved help/usage based on #187 2022-09-21 18:01:36 -07:00
Pranav
5a83edd3c4
Added build and test instructions 2022-09-21 13:10:14 -05:00
Pranav Srinivas Kumar
632ca2fcf8 Added prefix_chars and assign_chars to README #67 2022-09-21 09:53:30 -07:00
Pranav Srinivas Kumar
66730967aa Added support for custom prefix characters #67 2022-09-21 09:48:48 -07:00
Pranav
8c91f1a290
Added option=value example to table of contents 2022-09-21 09:24:17 -05:00
Pranav Srinivas Kumar
6dd2a3cf4b Added example to README for option=value support 2022-09-21 07:23:02 -07:00
Pranav Srinivas Kumar
6a3c6e06e6 Added 'Parse Known Args' section 2022-09-21 05:54:21 -07:00
Pranav Srinivas Kumar
4f10f378c5 Bumped version to v2.8 2022-09-20 21:21:06 -07:00
Pranav
c91fc8477a
Renamed section Subparsers -> Subcommands 2022-09-20 23:18:14 -05:00
Pranav
c879553fba
Fixed indentation in table of contents 2022-09-20 23:17:41 -05:00
Pranav Srinivas Kumar
793fbcde16 Added is_subcommand_used helper function 2022-09-20 21:15:58 -07:00
Pranav Srinivas Kumar
e35ce54028 Added example for subparser 2022-09-20 20:48:01 -07:00
Pranav Srinivas Kumar
6ed180f89e Updated copy constructor and added parser path to correctly print program name in help for subparsers 2022-09-20 20:45:32 -07:00
Pranav Srinivas Kumar
6c7da857b6 Added table of contents to README and clang formatted code 2022-09-20 20:27:24 -07:00
Pranav Srinivas Kumar
327e16c61b Bumped to version v2.7 2022-09-18 07:14:36 -07:00
Pranav Srinivas Kumar
e9099de7d4 Removed contributors list. See https://github.com/p-ranav/argparse/graphs/contributors for full list 2022-09-18 07:13:49 -07:00
Pranav
af282c0f68
Updated example to use std::string instead of cstring for default value 2022-09-07 08:30:22 -05:00
Adrian Schneider
17d567c283
Extend Readme with CMake FetchContent integration of argparse. 2022-07-09 17:04:02 +02:00
Pranav Srinivas Kumar
40a3888f15 Bumped version to v2.6 2022-06-22 10:59:52 -07:00
Yoshihiro Hokazono
acff046fc5 Use optional instead of zero_or_one 2022-06-22 09:24:51 +09:00
Yoshihiro Hokazono
e44023f424 Explain variable-length arguments in README 2022-06-22 07:55:48 +09:00
Pranav
571f8e3bff
Bumped version to v2.5 2022-05-27 07:29:42 -05:00
Sean Robinson
8b2357475f Add documentation for add_description and add_epilog
Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2022-04-27 08:01:25 -07:00
Pranav
e0d656ec71
Merge pull request #171 from Dennis-Bbg/master
Update README.md
2022-04-21 22:51:07 -05:00
Dennis-Bbg
71a9a7a53e
Update README.md
Fixed the example in section" #### Deciding if the value was given by the user".
2022-04-21 11:52:12 +02:00
Pranav Srinivas Kumar
4af831ef72 Bumped library version to v2.4 2022-04-20 08:37:27 -05:00
Pranav Srinivas Kumar
1a552dfd60 Bumped library version to v2.3 2022-04-01 19:05:46 -05:00
Pranav Srinivas Kumar
6f1a90f101 Removed duplicate entry for Daniel Marshall 2021-11-03 08:31:09 -05:00
Ashwin Rohit
2e25423db8 Modify README.md to show printing errors to stderr instead of stdout 2021-11-03 08:29:56 -05:00
Pranav
9c729f54b1
Updated contributors 2021-10-31 17:34:51 -05:00
Ashwin Rohit
2c55a2e423 Modify README.md to show printing errors to stderr instead of stdout 2021-10-31 12:29:19 -07:00
Sean Robinson
5cceb98e3c Update "Printing Help" documentation
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>
2021-10-27 09:02:33 -07:00