Pranav
ce2d4316a4
Merge pull request #330 from rouault/hidden_alias
...
Add a ArgumentParser::add_hidden_alias_for() method
2024-03-12 10:10:03 -04:00
Even Rouault
e6e41d43c6
Add a ArgumentParser::add_hidden_alias_for() method
...
It is sometimes desirable to offer an alias for an argument, but without it
appearing it in the usage. For example, to phase out a deprecated wording of
an argument while not breaking backwards compatible. This can be done with
the ``ArgumentParser::add_hidden_alias_for()` method.
```cpp
argparse::ArgumentParser program("test");
auto &arg = program.add_argument("--suppress").flag();
program.add_hidden_alias_for(arg, "--supress"); // old misspelled alias
```
2024-03-12 12:08:40 +01:00
Even Rouault
c1fb3c0005
Add ways to substitute strtof/strtod/strtold with custom functions
...
The standard strtof/strtod/strtold are by default locale-aware. There
are a number of situations where we'd rather want to be able to use
locale-independent parsing functions. This can be done by setting the
ARGPARSE_CUSTOM_STRTOF/ARGPARSE_CUSTOM_STRTOD/ARGPARSE_CUSTOM_STRTOLD
macros to the appropriate value.
2024-03-12 10:23:02 +01:00
Even Rouault
907b942db2
Change key of m_subparser_map and m_subparser_used to be a std::string to make clang -fsanitize=unsigned-integer-overflow happy
2024-03-11 22:37:14 +01:00
Even Rouault
c4406e2479
Change key of m_argument_map to be a std::string to make clang -fsanitize=unsigned-integer-overflow happy
2024-03-11 22:09:39 +01:00
LEE KYOUNGHEON
873596b41d
Move <errno> include outside the ARGPARSE_MODULE_USE_STD_MODULE
...
<errno> header exposes errno macro, which cannot be exported in C++ module. It must always included regardless of module usage.
2024-02-06 17:05:07 +09:00
Pranav Srinivas Kumar
f5287e2f20
Closes #307
2023-11-13 14:16:26 -08:00
Pranav Srinivas Kumar
16e2a1da72
Added support for binary notation, e.g., 0b101
2023-11-05 19:06:50 -06:00
Pranav Srinivas Kumar
f84fa8484a
Marked copy and move constructors as deleted
2023-11-05 18:13:17 -06:00
Pranav Srinivas Kumar
3596748798
Removed test code
2023-11-05 17:10:27 -06:00
Alexey Ismagilov
33146122a2
NEW: suppress flag for subcommand
...
resolve #258
2023-11-05 15:23:15 +03:00
Pranav Srinivas Kumar
a9869150fd
Changed from using std::set to std::vector for mutex_args elements
2023-11-04 15:51:22 -05:00
Pranav Srinivas Kumar
ecccae530c
Using size_t for levenshtein distance
2023-11-04 15:48:13 -05:00
Pranav Srinivas Kumar
b43c0a7e83
Addressed clang-tidy issues
2023-11-04 15:46:41 -05:00
Pranav Srinivas Kumar
de4239483d
Added logic and unit tests for the required flag in mutex_args
2023-11-04 15:36:01 -05:00
Pranav Srinivas Kumar
eea95c0e3a
Added mutex args to copy constructor, changed to ordered set for data structure
2023-11-04 15:19:10 -05:00
Pranav Srinivas Kumar
39988ec62d
Initial commit for implementing MutuallyExclusiveGroup
2023-11-04 14:57:01 -05:00
Pranav Srinivas Kumar
281f1ab017
Closes #113 , add custom std::ostream& argument to ArgumentParser constructor
2023-11-04 09:31:13 -05:00
Pranav Srinivas Kumar
c6e64ae36d
Simplified logic in error reporting, asking user if they meant to use a specific optional argument
2023-11-04 09:11:34 -05:00
Pranav Srinivas Kumar
62052fefcb
Closes #285
2023-11-04 09:01:31 -05:00
Pranav Srinivas Kumar
7657a22001
Updated formatting of error message, showing all variations of argument name
2023-11-03 22:18:08 -05:00
Pranav Srinivas Kumar
78ba5e9828
Removed brackets and quotes in error message
2023-11-03 22:12:00 -05:00
Pranav Srinivas Kumar
4111905a74
Improved error reporting for #299
2023-11-03 22:05:46 -05:00
cobyj33
9e647254f8
More descriptive parse_number errors
2023-10-28 00:26:08 -05:00
Pranav Srinivas Kumar
716ec60291
Added flag() shorthand function
2023-10-27 16:37:20 -05:00
Pranav Srinivas Kumar
5e7ce61ca7
Closes #278
2023-10-27 12:59:04 -05:00
Pranav Srinivas Kumar
d28188f4d5
Closes #247
2023-10-27 12:34:57 -05:00
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