Commit Graph

160 Commits

Author SHA1 Message Date
Pranav
e0d656ec71
Merge pull request #171 from Dennis-Bbg/master
Update README.md
2022-04-21 22:51:07 -05:00
Dennis-Bbg
71a9a7a53e
Update README.md
Fixed the example in section" #### Deciding if the value was given by the user".
2022-04-21 11:52:12 +02:00
Pranav Srinivas Kumar
4af831ef72 Bumped library version to v2.4 2022-04-20 08:37:27 -05:00
Pranav Srinivas Kumar
1a552dfd60 Bumped library version to v2.3 2022-04-01 19:05:46 -05:00
Pranav Srinivas Kumar
6f1a90f101 Removed duplicate entry for Daniel Marshall 2021-11-03 08:31:09 -05:00
Ashwin Rohit
2e25423db8 Modify README.md to show printing errors to stderr instead of stdout 2021-11-03 08:29:56 -05:00
Pranav
9c729f54b1
Updated contributors 2021-10-31 17:34:51 -05:00
Ashwin Rohit
2c55a2e423 Modify README.md to show printing errors to stderr instead of stdout 2021-10-31 12:29:19 -07:00
Sean Robinson
5cceb98e3c Update "Printing Help" documentation
Help output has changed format over time.  This updates the README
example to reflect current practice by running the example code
and copy-pasting its output.

Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2021-10-27 09:02:33 -07: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
58777d8c84 Replace spaces with underscores in example program names
These examples give a false impression that a space in the middle of the
application name is well handled.  While a space might be possible, it
must be escaped in shells, i.e. a common environment for a CLI argument
parser.

Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2021-10-27 09:02:33 -07:00
Sean Robinson
8772b37aab Update examples from exit() to std::exit()
argparse seems to use the "std::" qualifier for std namespace members,
continue that in the documentation.

Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
2021-10-27 09:02:33 -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
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
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
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
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
33101e7972 Closes #73 2020-05-08 14:35:05 -05:00
Pranav
45664c4e9f
Update README.md 2020-01-02 20:58:10 -06:00
Pranav
e06890af97
Update README.md 2019-12-01 16:56:19 -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
Zhihao Yuan
ea2f16d264
Upgrade and describe supported toolchains 2019-11-25 17:23:28 -06:00
Pranav
9cac1d0fed
Update README.md 2019-11-22 08:02:44 -06:00
Pranav Srinivas Kumar
da58b28ccb
Update README.md 2019-11-21 10:00:43 -06:00
Pranav Srinivas Kumar
c95835acf8
Update README.md 2019-11-21 08:37:47 -06:00
Pranav Srinivas Kumar
b42c6b7c7e
Update README.md 2019-11-21 08:37:04 -06:00
Pranav Srinivas Kumar
c803c32804
Update README.md 2019-11-21 08:29:34 -06:00
Zhihao Yuan
3f949fc3f1
Stop sharing argument values with parent parsers
See also: p-ranav/argparse#50
2019-11-16 14:33:00 -06:00
Zhihao Yuan
dc74051832
Deprecate print_help()
closes: p-ranav/argparse#40
2019-11-13 02:40:15 -06:00
Pranav Srinivas Kumar
79eba4e81f
Update README.md 2019-09-13 19:47:44 -05:00
Pranav Srinivas Kumar
61e9b644c0
Update README.md 2019-09-10 10:15:15 -05:00
Pranav Srinivas Kumar
db9f81e19a
Update README.md 2019-08-27 10:28:40 -05:00
Pranav Srinivas Kumar
8df0a878ac Merge branch 'master' of github.com:p-ranav/argparse 2019-08-17 16:57:15 -05:00
Pranav Srinivas Kumar
e40d9d5513 Closes #35 2019-08-17 16:57:00 -05:00
Pranav Srinivas Kumar
a2bd798920
Update README.md 2019-06-16 16:36:05 -04:00
Pranav Srinivas Kumar
2c71311b5f
Update README.md 2019-06-09 12:31:58 -04:00
Pranav Srinivas Kumar
6e69548d82
Addresses Issue #25 2019-06-06 21:30:31 -04:00
Pranav Srinivas Kumar
2125f34d35
Update README.md 2019-06-05 15:48:12 -04:00
Pranav Srinivas Kumar
3ff61cce4b
Fixes Issue #23 2019-06-05 15:30:08 -04:00
Pranav Srinivas Kumar
374c70e7b3
Fixes issue #8 2019-05-01 20:13:10 -04:00
Pranav Srinivas Kumar
a80b960ea3
Update README.md 2019-04-28 19:30:52 -04:00
Pranav Srinivas Kumar
f011fd35ff
Update README.md 2019-04-24 14:17:55 -04:00
Pranav Srinivas Kumar
b35cee19e2
Update README.md 2019-04-19 21:09:17 -04:00
Pranav Srinivas Kumar
a60cb8baa2
Update README.md 2019-04-09 15:04:03 -04:00
Pranav Srinivas Kumar
bf3f582740
Update README.md 2019-04-09 14:55:08 -04:00
Pranav Srinivas Kumar
bc4eddc138
Update README.md 2019-04-09 07:46:47 -04:00
Pranav Srinivas Kumar
29f0c52f5f
Update README.md 2019-04-02 07:21:14 -04:00
Pranav Srinivas Kumar
ba8af57470
Update README.md 2019-04-01 23:47:49 -04:00
Pranav Srinivas Kumar
ad016b3c6e
Update README.md 2019-04-01 23:45:25 -04:00
Pranav Srinivas Kumar
c3e4853729
Update README.md 2019-04-01 23:31:27 -04:00
Pranav Srinivas Kumar
9ffa511dac
Update README.md 2019-04-01 23:28:17 -04:00
Pranav Srinivas Kumar
11729b4dfe
Update README.md 2019-04-01 21:53:04 -04:00
Pranav Srinivas Kumar
2bc003018d
Update README.md 2019-04-01 21:43:55 -04:00
Pranav Srinivas Kumar
63309d3e2a
Update README.md 2019-04-01 20:53:04 -04:00
Pranav Srinivas Kumar
b11d357d9a
Update README.md 2019-04-01 20:52:36 -04:00
Pranav Srinivas Kumar
7abad0986d
Update README.md 2019-04-01 20:46:39 -04:00
Pranav Srinivas Kumar
91d0dd8c90
Update README.md 2019-04-01 20:45:49 -04:00
Pranav Srinivas Kumar
a0a2e76d22
Update README.md 2019-04-01 20:09:19 -04:00
Pranav Srinivas Kumar
c47f842c19
Update README.md 2019-04-01 19:59:57 -04:00
Pranav Srinivas Kumar
347881f5b3
Update README.md 2019-04-01 19:58:41 -04:00
Pranav Srinivas Kumar
1d85a98c42
Update README.md 2019-04-01 19:57:22 -04:00
Pranav Srinivas Kumar
2149ab40b9
Update README.md 2019-04-01 19:56:55 -04:00
Pranav Srinivas Kumar
acd9e02d77
Update README.md 2019-04-01 19:56:25 -04:00
Pranav Srinivas Kumar
082938e2cd
Update README.md 2019-04-01 19:55:23 -04:00
Pranav Srinivas Kumar
3733ce170f
Update README.md 2019-04-01 19:54:48 -04:00
Pranav Srinivas Kumar
d09fb9af99
Update README.md 2019-04-01 19:54:24 -04:00
Pranav Srinivas Kumar
4953ba7d76
Update README.md 2019-04-01 19:47:02 -04:00
Pranav Srinivas Kumar
c0099269db
Update README.md 2019-04-01 19:46:34 -04:00
Pranav Srinivas Kumar
1bd5d39a99
Update README.md 2019-04-01 19:45:09 -04:00
Pranav Srinivas Kumar
ecddddd519
Update README.md 2019-04-01 12:04:13 -04:00
Pranav Srinivas Kumar
11b3b30286
Update README.md 2019-04-01 10:27:35 -04:00
Pranav Srinivas Kumar
ad4bb635a7
Update README.md 2019-03-31 22:05:29 -04:00
Pranav Srinivas Kumar
87c42cd3ea
Update README.md 2019-03-31 18:08:37 -04:00
Pranav Srinivas Kumar
d0acbfdfb6
Update README.md 2019-03-31 18:02:47 -04:00
Pranav Srinivas Kumar
c9d0c0098e
Update README.md 2019-03-31 17:55:33 -04:00
Pranav Srinivas Kumar
e7b32d5a34
Update README.md 2019-03-31 17:54:40 -04:00
Pranav Srinivas Kumar
fd884c340c
Update README.md 2019-03-31 17:53:40 -04:00
Pranav Srinivas Kumar
ea5fdb49c8
Update README.md 2019-03-31 17:53:18 -04:00
Pranav Srinivas Kumar
9120c7ef2a
Update README.md 2019-03-31 17:51:08 -04:00
Pranav Srinivas Kumar
48c6365ef5
Update README.md 2019-03-31 17:35:34 -04:00
Pranav Srinivas Kumar
b3c83177e4
Update README.md 2019-03-31 17:33:39 -04:00
Pranav Srinivas Kumar
d5c6f7c8ef
Update README.md 2019-03-31 17:28:10 -04:00
Pranav Srinivas Kumar
0eea21ba94
Update README.md 2019-03-31 17:27:13 -04:00
Pranav Srinivas Kumar
a27fad3864
Update README.md 2019-03-31 17:25:40 -04:00
Pranav Srinivas Kumar
216530e330
Update README.md 2019-03-31 17:21:25 -04:00
Pranav Srinivas Kumar
cb69613899
Update README.md 2019-03-31 17:19:56 -04:00
Pranav Srinivas Kumar
1b9ab8cd13
Update README.md 2019-03-31 17:18:49 -04:00
Pranav Srinivas Kumar
132a73ae8e
Update README.md 2019-03-31 17:12:58 -04:00
Pranav Srinivas Kumar
058ab1d876
Update README.md 2019-03-31 17:04:11 -04:00
Pranav Srinivas Kumar
aeb4244581
Update README.md 2019-03-31 17:03:40 -04:00
Pranav Srinivas Kumar
921e5ca7f4
Update README.md 2019-03-31 16:58:18 -04:00
Pranav Srinivas Kumar
4dc61b679e
Update README.md 2019-03-31 16:28:49 -04:00
Pranav Srinivas Kumar
6425bed8ce
Update README.md 2019-03-31 13:08:17 -04:00
Pranav Srinivas Kumar
2d6fe42141
Update README.md 2019-03-31 13:06:55 -04:00
Pranav Srinivas Kumar
bf4902bde4
Update README.md 2019-03-31 11:46:21 -04:00
Pranav Srinivas Kumar
0c71e3c6f2
Update README.md 2019-03-31 11:43:24 -04:00
Pranav Srinivas Kumar
9e1c0bbc2f
Update README.md 2019-03-31 11:15:05 -04:00