Commit Graph

275 Commits

Author SHA1 Message Date
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
Sean Robinson
14097df904 Clean miscellaneous source styling
Clears warnings for the following checks in clang-tidy:
  readability-braces-around-statements
  readability-else-after-return checks

Also adds hints about code style to CONTRIBUTING document.

Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2022-07-06 10:03:56 -07:00
Sean Robinson
2460019e2e Update copyright date
Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2022-06-22 14:02:00 -07:00
Yoshihiro Hokazono
ed84d90d89 Move NArgsRange to private: because it is detail of implementation 2022-06-22 09:30:36 +09:00
Yoshihiro Hokazono
25d24c731b SizeRange -> NArgsRange 2022-06-22 09:26:43 +09:00
Yoshihiro Hokazono
acff046fc5 Use optional instead of zero_or_one 2022-06-22 09:24:51 +09:00
Yoshihiro Hokazono
df6e7de86a Prefer empty() to size() == 0 2022-06-22 07:15:50 +09:00
Yoshihiro Hokazono
5d6544a04e Retrieve changes on 37a1f3b9e6 2022-06-22 07:11:52 +09:00
Yoshihiro Hokazono
b869b5a209 NArgsPattern -> nargs_pattern (to snake case) 2022-06-22 07:07:59 +09:00
Yoshihiro Hokazono
08943f47ab Merge branch 'master' into feature/variable-length-nargs 2022-06-21 08:36:33 +09:00
Yoshihiro Hokazono
3459eec647 Make throw_* funcs and make validate() clearer 2022-06-21 07:14:09 +09:00
Yoshihiro Hokazono
0195a5065c Complete "remainig" backward compatibility 2022-06-21 06:45:26 +09:00
Tomáš Pecka
95d4850683 Add missing <utility> include
After upgrading g++ package to 12.1.0 on archlinux I see the following
compilation error:

  /usr/include/argparse/argparse.hpp: In member function ‘void argparse::ArgumentParser::index_argument(list_iterator)’:
  /usr/include/argparse/argparse.hpp:1167:34: error: ‘as_const’ is not a member of ‘std’; did you mean ‘is_const’?
   1167 |     for (const auto &name : std::as_const(it->m_names)) {
        |                                  ^~~~~~~~
        |                                  is_const

It turns out that std::as_const comes from <utility> header [1] which
was not explicitly included.

[1] https://en.cppreference.com/w/cpp/utility/as_const
2022-05-15 16:04:38 +02:00
Érico Nogueira
82eed31d3f Fix remaining unused argument warnings.
Commit 5c5c55b83c missed one such
occurrence.
2022-05-09 14:35:50 -03:00
Sean Robinson
c4faf29feb Replace cend with std::cend
Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2022-04-27 08:00:51 -07:00
Sean Robinson
37a1f3b9e6 Remove unused code in Argument::validate
As far as I can tell, this statement is never true.

When m_values.size() < *expected, ::consume has already thrown "Too few
arguments..." before ::validate is called.

When m_values.size() > *expected, ArgumentParser::parse_args_internal
has already thrown "Maximum number of positional arguments exceeded"
before ::validate is called.

If ::remaining is used to avoid the last exception, this Argument will
always consume the expected number of values, hence this expression is
again false.

Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2022-04-27 08:00:17 -07:00
Pranav
b9dd1ef8e3
Merge pull request #162 from skrobinson/wip-port-aayush749-fixes
Port aayush749 fixes
2022-04-25 16:17:16 -07:00
Érico Nogueira
5c5c55b83c Fix unused argument warnings.
Solution suggested by skrobinson. This way, GCC and clang-tidy don't
generate warnings.

Fixes: https://github.com/p-ranav/argparse/issues/167
2022-04-19 13:59:08 -03:00
Érico Nogueira
3b89546fd0 Fix regression in version printing.
This regression was caused by commit
ea1f7ef663, which didn't add "\n" to the
version printing statement. We use std::endl now for compatibility
across platforms.
2022-04-13 10:29:37 -03:00
Sean Robinson
67d2e4476f Annotate range-for loops' structured bindings as [[maybe_unused]]
The 'unused' variable in both cases is most-definitely unused in the loop.
This is a cppcheck warning that appeared after moving these two loops to
range-for.

Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2022-03-24 14:21:14 -07:00
Sean Robinson
843e4eefb0 Move ArgumentParser::parse_args_validate logic into ::parse_args
This code was previously moved from ::parse_args to its own method, but
has since been simplified.  Moving the actual work to Argument::validate
in commit 603e87ae6 leaves a single loop that fits back into ::parse_args.

Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2022-03-24 14:19:20 -07:00
Sean Robinson
063d708c3e Modify ArgumentParser::get_length_of_longest_argument method run in O(1) space
Closes #124

Reported-by: Aayush Anand <aaayushanand5@gmail.com>
Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2022-03-23 15:02:42 -07:00
Aayush Anand
0d868fdca8 Modify ArgumentParser::parse_args_validate() method to use a for loop instead of std::for_each()
Suggested-by: Aayush Anand <aaayushanand5@gmail.com>
[skrobinson: Updated for latest formatting and naming conventions]
Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2022-03-23 15:02:42 -07:00
Sean Robinson
ce3c43eb9b Rename identifiers
There are no functional changes in this commit.

Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2022-02-10 09:41:20 -07:00
Sean Robinson
985ea8666d Update identifier names for structs
The new naming pattern is CamelCase for structs, except parse_number as a
primarily callable interface.  Trait structs are named Has*Traits
and constexpr variables to the struct template are named Is*.

Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2022-02-09 15:53:08 -07:00
Sean Robinson
c50346c1df Remove is_representable_v trait
This trait is unused and removing it does not cause any tests to fail.

Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2022-02-09 15:53:08 -07:00
Sean Robinson
cb2777db6e Update header source format with clang-format
Most changes are to better fit within "ColumnLimit: 80".

The change from "T &&... var" to "T &&...var" is caused by
"PointerAlignment: Right".

Member functions chained from add_argument() use ContinuationIndentWidth,
which is set to 4.  Setting ContinuationIndentWidth to 2 causes many
other continuation lines to change.  So, this commit uses the original
value (i.e. 4) as the preferred size.

Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2022-02-09 15:53:08 -07:00
Sean Robinson
a915728da0 Enable clang-tidy cppcoreguidelines-avoid-c-arrays check
Also converts most C-style arrays to a std::array onjects.  The check is
disabled for ArgumentParser::parse_args(int, const char *const[]) as this
is a helper function to convert away from a common input format.

Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2022-02-09 15:53:08 -07:00
Sean Robinson
d0a492ccba Enable clang-tidy readability-else-after-return check
A common pattern in the previous code was goto/return/throw if a condition
is true, else goto/return/throw something different.  The new pattern
uses the fact that the second goto/return/throw is only reachable when the
first goto/return/throw is not called.

Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2022-02-09 15:53:08 -07:00
Sean Robinson
0b74da54d4 Enable clang-tidy cppcoreguidelines-special-member-functions check
Also adds a default destructor, as recommended by the check.

Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2022-02-09 15:53:08 -07:00
Sean Robinson
c25a959597 Enable clang-tidy readability-static-accessed-through-instance check
Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2022-02-09 15:53:08 -07:00
Sean Robinson
bd4837f240 Enable clang-tidy's readability-qualified-auto check
Following the clang-tidy suggested fix in consume_digits causes compile
failures with MSVC 19.29 in our CI.

Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2022-02-09 15:27:16 -07:00
Sean Robinson
b5fb663bc8 Enable clang-tidy readability-named-parameter check
Adds names recommended by clang-tidy (e.g. "unused").

Note that clang-tidy v12 appears to detect unnamed parameters in lambdas,
while clang-tidy v13 does not.

Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2022-02-09 14:05:21 -07:00
Sean Robinson
9eb1fe5cef Enable clang-tidy readability-magic-numbers check
Adds names for integer bases used with details::parse_number.

Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2022-02-07 14:29:25 -07:00
Sean Robinson
7cbc66f65b Return default_arguments from operator& of two default_arguments
operator& should return combined values of the same type, not a new type
(i.e. bool).  This is much more verbose, but easier to reason about
without implied conversion.

Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2022-02-07 14:27:06 -07:00
Sean Robinson
6a8b1318ec Enable clang-tidy readability-container-size-empty check
Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2022-02-07 14:27:06 -07:00
Sean Robinson
158b8a0d2f Enable clang-tidy readability-braces-around-statements check
All tests still pass.

Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2022-02-07 13:10:03 -07:00
Sean Robinson
c0bbcf613c Remove sentry check in ArgumentParser::operator<<
cppcheck reports "Variable 'sen' is assigned a value that is never used.
[unreadVariable]" for this line.

As far as I understand, std::ostream::sentry is used to prepare access to
the stream buffer.  But, we are never directly accessing the stream
buffer.  Stream access in this function uses other operator<< functions.

Most noise in this patch is about unindenting after if() removal.

Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2021-11-10 13:54:35 -07:00
Sean Robinson
abb2206141 Declare lambda parameter and ArgumentParser::print_help as const
These were respectively reported as constParameter and functionConst
style issues by cppcheck.

Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2021-11-10 13:54:33 -07:00
Sean Robinson
6530a06747 Copy more members in ArgumentParser copy constructor
This showed as a cppcheck warning: uninitMemberVar.

Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2021-11-10 13:54:31 -07:00
Maciej Patro
87afaba6ba Improve thrown message in case of invalid argument.
Now message contains information which argument is the source of error.
It's easier to spot typo/understand which part of more complex command
is the source of problem.
2021-11-05 09:56:17 +01: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
Sean Robinson
2b05334a3c Run Argumnet::action functor for zero-parameter arguments
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>
2021-10-27 09:02:33 -07:00
Sean Robinson
748bc95cf5 Rename inner scope variables to differ from outer scope
These variables with the same name are not the same variables because of
scope rules.  While the compiler is not confused by this naming, it may
be less readable by someone attempting to edit this code.

Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2021-10-27 09:02:33 -07:00
Sean Robinson
500bc9277e Add ArgumentParser::mIsParsed to copied members
MSVC 19.16 appears to be doing a copy rather than a move in
test_const_correct.  The copy ctor does not handle mIsParsed, so the
initial false value is kept.  This commit adds copying mIsParsed during
copy construction.

Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2021-10-27 07:35:52 -07:00
Yoshihiro Hokazono
14abaa47d9 Use member initializer list to SizeRange ctor 2021-09-16 08:01:27 +09:00
Yoshihiro Hokazono
bec93acaa7 Avoid use ALL_CAPS for enumerators 2021-09-16 08:01:26 +09:00
Yoshihiro Hokazono
3d559d3a23 Revive remaining method
I reimplemented remaining() method for backward compatibility.

It consumes "all" remaining args.

So, I added mAcceptsOptionalLikeValue flag and handle it by using this
flag.

Currently, remaining() behavior is slightly different from the original when no
args are provided and get<Container<T>>() method is called.
Originally it raises an exception. But current implementation returns
an empty container instead of exception.

It is possible to implement complete backward compatibility by
referencing mAcceptsOptionalLikeValue flag and raises an exception in get() method,
but I did not do this.
I think that is too much.
2021-09-16 07:54:00 +09:00
Yoshihiro Hokazono
c6c3be04d3 1st version of handling variable length nargs
To handle variable length nargs, I replaced mNumArgs with mNumArgsRange.
I defined SizeRange class for mNumArgsRange, which has simply min and
max std::size_t member.

To concentrate on this big change, I tentatively deleted remaining
feature, which was originally implemented in the way that mNumArgs = -1
internally and maybe_args() -> Optional wrap method.

Library users may make use of 4 types of interface to set
mNumArgsRange.

1. nargs(std::size_t)
2. nargs(std::size_t, std::size_t)
3. nargs(SizeRange)
4. nargs(NArgsPattern)

1. is expected to behave same as original. This mthod sets min=max
SizeRange to mNumArgsRange, which is actually, not a range, but an
"exact" number.

2. sets min and max.

3. uses SizeRange class. This interface may be unnecessary. It is also
an option to delete this method and make SizeRange class internal.

4. is provided to set common patterns. In Python, they are "?", "*" and
"+". NArgsPattern is an enum class for type safety. std::string
interface is also an option to mimic Python argparse. char interface
would be ambiguous with 1.

Changes on consume method is important.
The parser tries to consume args until the count reaches mNumArgsRanges::max or
it meets another optional like string.
If consumed args count is under mNumArgsRanges::min, the parser fails.

Now, when the required number of arguments are not provided, the parser
will fail.
So, we have to take care of get() method as well.
get() failed when argument count is 0 and default value not provided.
But now there are 0..1 or 0..* nargs are OK.
So this behaviour has to be fixed.
When T is container_v, it returns empty container.

I implemented validate method so that it shows kind message.
2021-09-16 07:22:46 +09:00
Sean Robinson
f0d68de134 Confirm arguments are parsed before allowing ArgumentParser::get
If the developer forgot to call ArgumentParser::parse_args<>, attempts to
use ::get, ::present, etc., would raise "No value provided...".  With this
change, the error better describes what went wrong.

Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2021-09-14 09:55:03 -07:00
Sean Robinson
6344b5dcc7 Add argument name in exception thrown by Argument::consume
Here, the user gave an argument name but failed to provide the required
parameters to the argument.  Tell the user which argument wants more.

This is an API change that may affect programs trying to match the
specific "Too few arguments" message.  The new error message appends the
user-supplied argument that caused the error.

A solution which works with both versions is to look for "Too few
arguments" at the beginning of the error message.

- if (err.what() == "Too few arguments")
+ if (std:string(err.what()).rfind("Too few arguments", 0) == 0)

Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2021-09-14 09:54:43 -07:00
Sean Robinson
1c2fd8726d Add argument name in exception thrown by Argument::get
As the user did not include the argument, the longest name for the unused
argument is in the last position of mNames.

This is an API change that may affect programs trying to match the
specific "No value provided" message.  The new error message appends the
argument that caused the error.

A solution which works with both versions is to look for "No value
provided" at the beginning of the error message.

- if (err.what() == "No value provided")
+ if (std:string(err.what()).rfind("No value provided", 0) == 0)

Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2021-09-14 09:51:10 -07:00
Yoshihiro Hokazono
971f687a17 Kind error message 2021-09-13 07:08:37 +09:00
Yoshihiro Hokazono
8727c132fc get("out") and get("--out") are both avaibale 2021-09-13 07:07:20 +09:00
Sean Robinson
37dc4f20ec Revert "Use std::chars_format rather than local copy"
It's too early to use std::chars_format as there is not wide enough
support in stdlib implementations.  After the following stdlib become our
supported versions, this can be revisited.

GCC >= 10.1.0
Clang >= 7.0.0 (already our minimum)
MSVC >= 19.4

Reverts commit 1c61082a4c.

Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2021-08-26 06:55:36 -07:00
Sean Robinson
1c61082a4c Use std::chars_format rather than local copy
I believe the Supported Toolchains all now include <charconv> (and
std::chars_format) and we can use the stdlib-defined values.

Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2021-08-24 09:20:50 -07:00
Pranav
ccf3920ce2
Merge pull request #108 from Bedzior/const-correct-argument-parser
Const-correct ArgumentParser
2021-08-07 07:22:12 -05:00
Chuvi
a3f164bcc7 Replace size_t to std::size_t.
https://github.com/p-ranav/argparse/pull/109#issuecomment-892943775
2021-08-05 16:06:06 +03:00
Chuvi
0652496435
Use std::min type specialisation 2021-08-04 19:43:20 +03:00
Chuvi
14fd4c6d5b Fix std::min conflict with min/max definitions from windows.h 2021-08-04 13:54:46 +03:00
Rafal Bedzkowski
4ede429264 Const-correct ArgumentParser 2021-08-02 17:21:46 +02:00