Commit Graph

381 Commits

Author SHA1 Message Date
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
Pranav Srinivas Kumar
f3e65f69a9 Added --version as a special flag similar to --help
* ArgumentParser takes a second argument - the program version (std::string)
* Using --version or -v will print the program version and exit
2020-05-15 19:06:00 -05:00
Pranav
f1ccf8e1ee
Merge pull request #77 from lichray/fix-ci
Avoid use of cmd.exe in Travis
2020-05-12 23:20:57 -05:00
Zhihao Yuan
15e4d44f11
Avoid use of cmd.exe in Travis 2020-05-12 22:42:57 -05:00
Pranav Srinivas Kumar
33101e7972 Closes #73 2020-05-08 14:35:05 -05:00
Pranav Srinivas Kumar
9bbd58c6ad Closes #76 2020-05-08 14:27:20 -05:00
Pranav Srinivas Kumar
3734fc6fca Closes #74 2020-04-23 07:36:22 -07:00
Pranav Srinivas Kumar
4c69ebf3fe Placing definitions in unnamed namespace to prevent multiple definition linker error #75 2020-04-12 09:38:21 -05:00
Pranav
45664c4e9f
Update README.md 2020-01-02 20:58:10 -06:00
Pranav
f01beb872e
Merge pull request #72 from CrustyAuklet/text-pre-post
Add the option to add text before and after help output
2020-01-02 20:55:39 -06:00
Ethan Slattery
c521ebeaf8 add extra space to match python formatting 2020-01-02 18:42:25 -08:00
Ethan Slattery
7ef0de410b Better naming: follow python naming convention. 2020-01-02 15:14:20 -08:00
Ethan Slattery
89b9e22f9a add pre and post text options
add variables, assignment functions, and printing for text before and after the argument lists.
2020-01-02 14:15:44 -08:00
Pranav
c13e83d0b3
Merge pull request #71 from lichray/simplify-misc
Simplify a few internals
2020-01-02 05:33:26 -06:00
Zhihao Yuan
7c57e1e852
Record used names with copies of string_view 2020-01-02 02:19:09 -06:00
Zhihao Yuan
03a0ce831d
Simplify Argument exposition-only constructors
Although they are public, they are not meant for end-users
to use, so we can change its interface to use less sfinae.
2020-01-02 02:19:08 -06:00
Pranav
e06890af97
Update README.md 2019-12-01 16:56:19 -06:00
Pranav
aed278419d
Merge pull request #68 from zhihaoy/std-optional
Get arguments in optional<T> with .present<T>()
2019-12-01 16:55:32 -06:00
Zhihao Yuan
e6c6c9b31c
Get arguments in optional<T> with .present<T>()
fixes: p-ranav/argparse#66
2019-12-01 02:14:13 -06:00
Pranav
4277e68e57
Merge pull request #65 from lichray/scan
Simplify parsing numeric arguments with .scan
2019-11-26 08:12:24 -06:00
Zhihao Yuan
e8a44d289d
Parse floating-point numbers in .scan
fixes: p-ranav/argparse#63
2019-11-26 00:11:21 -06:00
Zhihao Yuan
426a5dbb76
Parse integers in the .scan fluent interface 2019-11-25 23:45:55 -06:00
Zhihao Yuan
ea2f16d264
Upgrade and describe supported toolchains 2019-11-25 17:23:28 -06:00
Pranav
c851668339
Merge pull request #64 from lichray/negative
Determine negative numeric values with a grammar
2019-11-24 19:53:53 -06:00
Zhihao Yuan
964790cf3c
Determine negative numeric values with a grammar
Two differences that diverge from the existing behavior:

  1. Leading zeros are not allowed for integers.  Negative
     octal numbers such as `-066` are not meant to be treated
     as positional arguments, but existing code recognize them
     as decimal numbers.  Note that negative floating-point
     numbers with leading zeros (`-003.`) are unambiguous and
     are recognized.
  2. Inf and NaN are not recognized.  This is because options
     like `-inf` is indistinguishable from a compound argument
     that meant to be a shorthand for `-i -n -f`.

fixes: p-ranav/argparse#55
2019-11-24 00:31:05 -06:00
Pranav
473d550ea3
Merge pull request #61 from zhihaoy/exit-on-help
Default --help to print help and exit
2019-11-22 18:01:23 -06:00
Zhihao Yuan
77f3bd9b8d
Default --help to print help and exit
The change also fixes a rare bug introduced in 9007958:
when there are duplicated keys, insert_or_update overrides
previously inserted ones, emplace doesn't.

fixes: p-ranav/argparse#59
2019-11-22 16:54:58 -06:00
Pranav
4cc2c75dec
Merge pull request #60 from zhihaoy/fix-help
Fix print_help for printing nothing
2019-11-22 15:45:58 -06:00
Zhihao Yuan
36003197c7
Fix print_help for printing nothing 2019-11-22 15:33:15 -06:00
Pranav
9cac1d0fed
Update README.md 2019-11-22 08:02:44 -06:00
Pranav
423c0a225c
Merge pull request #58 from zhihaoy/test-suites
Annotate test cases with doctest::test_suite
2019-11-21 14:41:18 -06:00
Zhihao Yuan
1af8b826c8
Annotate test cases with doctest::test_suite
This change also explicitly lists the source files
for CMake.  This is because `GLOB` does not remove
old files when switching branches in Git, and
`CONFIGURE_DEPENDS` will add unstaged files after
stashing.

See also: https://cmake.org/cmake/help/latest/command/file.html#glob
2019-11-21 14:24:50 -06:00