Commit Graph

362 Commits

Author SHA1 Message Date
Pranav
4d03fc04b2
Merge pull request #121 from skrobinson/wip-add-scan-docs
Document and use Argument.scan where possible
2021-08-24 19:20:04 -05:00
Sean Robinson
a8900c2019 Replace simple type-converting Argument.action with Argument.scan in tests
Argument.scan handles simple string to numeric type conversions, removing
the need to create a lambda.  Argument.action is still necessary for more
complex conversions and those are left unchanged.

Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2021-08-24 09:25:49 -07:00
Sean Robinson
38a4a1a755 Replace simple type-converting Argument.action with Argument.scan in README
To better show the built-in conversion to a primitive type, use .scan in
examples.

Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2021-08-24 09:25:49 -07:00
Sean Robinson
bcc1f5adea Add documentation for Argument.scan
IMHO, the .scan function and its supporting functions are beautiful
metaprogramming that needs to be more visible to argparse users.  As a
start, document the function, with simple examples.

Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2021-08-24 09:25:49 -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
Pranav
6b1f4652ad
Merge pull request #110 from Chuvi-w/size_t_to_std_size_t
Replace size_t to std::size_t.
2021-08-05 08:25:05 -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
Pranav
801e2ef343
Merge pull request #109 from Chuvi-w/fix_std_min_conflict
Fix std::min conflict with min/max definitions from windows.h
2021-08-05 07:23:43 -05: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
5841bca894 Introduce separate const-correctness test 2021-08-03 22:12:05 +02:00
Rafal Bedzkowski
4ede429264 Const-correct ArgumentParser 2021-08-02 17:21:46 +02:00
Pranav
e1ea7ec50a
Merge pull request #107 from KOLANICH/cpack
Added packaging using CPack and generation of pkg-config files.
2021-07-21 07:52:28 -05:00
KOLANICH
9ba45adfe2 Added packaging using CPack and generation of pkg-config files.
Fixed installation directory - the lib is architecture-independent and so CMake and pkg-config files should go into <prefix>/lib, not into <prefix>/lib/<arch>
2021-07-21 13:11:52 +03:00
Pranav
64dd67c758
Merge pull request #103 from kfsone/optional-v
Allow user to limit version argument to --version
2021-06-04 19:03:00 -05:00
Oliver 'kfsone' Smith
38b1b8114e Allow user to limit version argument to --version 2021-06-04 16:56:22 -07:00
Pranav
1344889acf
Merge pull request #100 from skrobinson/wip-is_used-method
Add ArgumentParser.is_used to discern user-supplied values from defaults
2021-04-07 16:58:05 -05:00
Sean Robinson
3efd045ea9 Add ArgumentParser.is_used to discern user-supplied values from defaults
.present returns std::nullopt if the optional argument is not given by the
user -- as long as a .default_value is not defined.  With a .default_value,
.present cannot be used to determine if a value is user-provided or the
default.

.is_used fills that role and only returns true if the argument was passed
by the user.

Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2021-04-07 14:09:10 -07:00
Pranav
65f2ad4db2
Merge pull request #99 from skrobinson/wip-append-method
Add Argument.append method to allow repeated argument use
2021-04-07 14:26:45 -05:00
Sean Robinson
54d3cda804 Add Argument.append method to allow repeated argument use
The default behavior with optional arguments is to allow only a single use
per invocation.  One alternative is to use .nargs, but this requires
previously knowing, and limiting, the quantity of values.  The .append
method removes the restriction on repeats for a single Argument.

Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2021-04-07 11:47:09 -07:00
Pranav
9e9d969814
Merge pull request #98 from skrobinson/wip-clean-ups
misc clean ups
2021-04-07 12:37:36 -05:00
Sean Robinson
0fe17e22f6 Replace integers with bool value keywords
While the implicit conversions from `1` to `true` work correctly, this
avoids the conversions.

Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2021-04-06 12:07:53 -07:00
Sean Robinson
a711f26045 Remove trailing spaces from README lines
Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2021-04-06 12:07:53 -07:00
Sean Robinson
e371313b87 Update copyright dates and authors
The full list of contributors is available in the git commit log.

Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2021-04-06 11:53:19 -07:00
Pranav
165d560b3a
Merge pull request #97 from qoelet/qualify-iterator-functions
Qualify iterator functions
2021-03-25 08:55:17 -05:00
Kenny Shen
c869f20e2b Qualify iterator functions 2021-03-25 12:55:26 +08:00
Pranav
9903a22904
Merge pull request #93 from cekc/nicer-message-for-required
nicer usage text for required arg
2020-12-15 15:06:25 -06:00
Mike Zozu
ed06438faf nicer usage text for required arg 2020-12-15 23:01:07 +03:00
Pranav
68fb9f16d8
Merge pull request #92 from cekc/#88-show-default-value-in-help
Show default value for arg in help message
2020-12-15 13:15:52 -06:00
Mike Zozu
88f1614df6 revert MacOS image change 2020-12-15 22:07:27 +03:00
Mike Zozu
1f9591eabc Merge branch '#88-show-default-value-in-help' of github.com:cekc/argparse into #88-show-default-value-in-help 2020-12-15 22:01:29 +03:00
Mike Zozu
51dd98f49d fix is_streamable trait 2020-12-15 21:59:52 +03:00
Mike Zozu
bc6e948bca update MacOS image in Travis CI 2020-12-15 20:30:50 +03:00
Mike Zozu
69c2cada35 simplified traits using std::void_t 2020-12-15 20:01:26 +03:00
Mike Zozu
b025166e4c prettier output in case of absence of arg help msg 2020-12-15 19:09:08 +03:00
Mike Zozu
4de9f89b59 add tests for repr() and extend tests for help msg 2020-12-15 19:05:18 +03:00
Mike Zozu
6b30a65ffd special case for repr: bool value 2020-12-15 16:59:45 +03:00
Mike Zozu
5572cb0862 trying to fix strange AppleClang compiler error 2020-12-15 16:58:38 +03:00
Mike Zozu
6964cccd2f clang-format 2020-12-15 16:20:41 +03:00
Mike Zozu
282f9ebf91 show default values in help 2020-12-15 16:10:56 +03:00
Pranav
d0758e0ffa
Merge pull request #90 from rysson/issue/89-print_req_if_no_def_val
Fix help if required and def-value. Fixes #89.
2020-11-30 13:17:43 -06:00
Robert Kalinowski
bf12edd9a7 Fix help if required and def-value. Fixes #89.
Propose, skip text "[Required]" if argument has default value,
because the argument can be omitted in commend-line.
2020-11-30 19:53:06 +01:00
Pranav
535244d7b7
Merge pull request #86 from Ubpa/master
CMakeLists.txt : add export
2020-11-07 07:11:00 -06:00
Ubpa
86ad397b39 CMakeLists.txt : add export
make the project to be used from a build directory
reference: https://cmake.org/cmake/help/latest/guide/tutorial/index.html#adding-export-configuration-step-11
2020-11-07 12:23:22 +08:00
Pranav
0402f2b7c3
Merge pull request #82 from JadeMatrix/chainable
Make ArgumentParser::add_*() functions working on the parser itself chainable
2020-08-22 15:42:25 -05:00
Joseph Durel
aef670bd43 Make ArgumentParser::add_*() functions working on the parser itself chainable 2020-07-11 10:12:57 -04:00
Pranav
37264dc7f8
Merge pull request #79 from bufferbase/patch-1
Fix incorrect message when mUsedName is empty
2020-06-04 19:43:34 -05:00
bufferbase
43f4629be5
Fix incorrect message when mUsedName is empty
Previously, it printed ": expected 1 argument(s). 0 provided." when one positional argument is defined but nothing is provided. Now it prints "1 argument(s) expected. 0 provided."
2020-06-04 17:06:20 -07:00
Pranav
176da54c9b
Update README.md 2020-05-17 11:09:00 -05:00
Pranav
06649254b3
Update README.md 2020-05-15 19:12:43 -05:00