Pranav Srinivas Kumar
fd726fd341
Fixed clang tidy warning about struct name
2023-10-27 10:53:52 -05:00
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
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
Pranav
57b63b09fa
Merge pull request #290 from Arthapz/master
...
Add C++20 module
2023-10-20 08:06:14 -05:00
Kian-Meng Ang
aa25a2f3ac
Fix typos
...
Found via `codespell -L seh`
2023-10-19 13:09:11 +08:00
Arthur LAURENT
23aff1938a
add argparse C++20 module
2023-10-15 17:13:56 +02:00
Arthur LAURENT
7a13042264
use inline constexpr instead of static constexpr for free constants
2023-10-15 17:08:22 +02:00
Pranav
b0930ab028
Merge pull request #268 from fanurs/align_multiline_message
...
Fix issue #248 : Align multiline help messages
2023-07-11 08:15:12 -05:00
Fanurs
e82653c2d9
Fixed test for multiline help message alignment
2023-04-22 19:23:17 -04:00
Fanurs
5595375786
Changed padding from \t
to spaces
2023-04-22 15:15:39 -04:00
Fanurs
aa996952bb
Fixed clang-tidy issues
...
See https://github.com/p-ranav/argparse/pull/259#pullrequestreview-1284243420
2023-04-22 02:35:46 -04:00
Pranav
0b513829ac
Merge pull request #264 from skrobinson/feat-exit-choice
...
Add exit_on_default_arguments parameter to ArgumentParser
2023-03-29 11:54:15 -05: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
Nicholas Treffer
1c266d2791
Resolves the std::numeric_limits<std::size_t>::max)()} error
...
similar to this one https://github.com/microsoft/cppwinrt/issues/479
2023-03-17 14:16:08 +13:00
Pranav
e516556733
Merge pull request #254 from skrobinson/fix-maintenance
...
Various maintenance tasks
2023-02-19 10:29:59 -06:00
He Shiming
3d7596765b
implements column-aligned multi-line help message for arguments (issue #248 )
2023-01-30 19:28:07 +08:00
Sean Robinson
6974f46851
Revert "Use references for any_cast
"
...
This attempts to fix Issue #225-1 by reverting the change that turned a
std::bad_any_cast exception into a nullptr.
Reverts commit 357068156e
.
Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2023-01-17 13:57:59 -07:00
Sean Robinson
d845381028
Fix Argument bool bit fields
...
The intent of ": 1" is to use individual bits to store the bool state of
these class values. Because true != 0, this worked. But it was likely to
bite someone sometime. (My bad: 0fe17e22f6.)
This commit also adds m_accepts_optional_like_value to the bit field and
sets the default false value in the constructor.
Because we cannot set a default value during declaration (until C++20).
make sure future coders know to set the preferred default in the
constructor.
Closes #213
Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2023-01-17 13:57:59 -07:00
Sean Robinson
cb3da173f6
Fix crash with char[] default values
...
Closes #249
Reported-by: @pfeatherstone
Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2023-01-05 13:02:40 -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
Aayush Anand
6eb0ea7738
added fix for issue #235
2022-11-12 20:24:36 +05:30
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
Mark Gillard
04faefeae3
Fix std::string_view being identified as a container
2022-11-04 16:41:29 +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
f1d75bbb32
Remove unneeded explicit Compare function from map declarations
...
std::less<Key> is the standard's default comparison function, we do not
need to re-declare the same function.
Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2022-10-06 09:18:47 -07:00
Sean Robinson
50e3afd81d
Replace vector::operator[] use with vector::front
...
This is mostly a style change to match other parts of the code.
Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2022-09-23 08:05:33 -07:00
Sean Robinson
2a15178bb7
Include canonical argument name in nargs range validation error
...
The name of a positional argument is never used.
Closes #208
Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2022-09-23 07:54:58 -07:00
Pranav Srinivas Kumar
b1c7483cf5
Added additional samples and fixed parse_known_args API
2022-09-21 19:08:06 -07: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 Srinivas Kumar
d56515f6df
Removed static from lambda function, updated copy constructor for m_assign_chars
2022-09-21 10:58:25 -07:00
Pranav Srinivas Kumar
66730967aa
Added support for custom prefix characters #67
2022-09-21 09:48:48 -07:00
Pranav Srinivas Kumar
616062e2bf
Added -Wshadow and -Wconversion to CXX_FLAGS and fixed warnings
2022-09-21 07:43:46 -07:00
Pranav Srinivas Kumar
b2d2a58510
Removed test file
2022-09-21 07:25:18 -07:00
Pranav Srinivas Kumar
6dd2a3cf4b
Added example to README for option=value support
2022-09-21 07:23:02 -07:00
Pranav Srinivas Kumar
20095a697a
Added option=value support using #185
2022-09-21 06:54:34 -07:00
Pranav Srinivas Kumar
14287af007
Closes #94
2022-09-21 06:23:42 -07:00
Pranav Srinivas Kumar
6e23d5b22e
Closes #181
2022-09-21 05:47:47 -07:00
Pranav Srinivas Kumar
793fbcde16
Added is_subcommand_used helper function
2022-09-20 21:15:58 -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
6987a83ad5
Updated help to print subcommands list
2022-09-20 20:09:42 -07:00
Pranav Srinivas Kumar
2f2858a8a7
Draft implementation of subparsers #42
2022-09-20 19:54:29 -07:00
Randolf Jung
357068156e
Use references for any_cast
2022-09-03 19:56:33 +02:00
Randolf J
876aa99a97
Remove unnecessary back_inserter
2022-08-31 00:32:01 +02:00
Sean Robinson
a8e2823d68
Replace constexpr generic_strtod with inline const
...
clang-ci >= 13.0 is failing to compile a constexpr function pointer
assignment. This is possibly due to strtof (and family) not being
implemented as constexpr in the relevant libc++.
Closes #136
Closes #156
Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2022-08-11 14:02:38 -07:00
Jonas Schulze
ae5de262d2
Add empty line above epilog
2022-07-25 16:43:58 +02:00