-
Notifications
You must be signed in to change notification settings - Fork 256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Actions with nonary arguments, removable defaults, and some clean ups #142
Actions with nonary arguments, removable defaults, and some clean ups #142
Conversation
9b93643
to
b1e2112
Compare
Do you know what the problem is with the CI? |
Unfortunately, the test failure only shows with
The MSVC 2019 build runs fine. This may take some time to track down. |
b1e2112
to
60c3d0b
Compare
argparse seems to use the "std::" qualifier for std namespace members, continue that in the documentation. Signed-off-by: Sean Robinson <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 p-ranav#104 Signed-off-by: Sean Robinson <[email protected]>
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 p-ranav#119 Closes p-ranav#138 Closes p-ranav#139 Signed-off-by: Sean Robinson <[email protected]>
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 <[email protected]>
60c3d0b
to
5cceb98
Compare
I was able to resolve this faster than I expected. This branch has been rebased on the post-#143 master and now passes tests in our five OS/compiler environments. While researching the test fails, I saw that the GitHub windows-2016 environment is deprecated will be disabled in early 2022. Sometime before then, I'll submit a PR removing that config from our tests. |
I've seen several requests to change the behavior of
--help
and--version
with regard to exit() ending program execution. On the way to solving these requests, I needed to add nonary argument actions. This patch series includes other small fixes found along the way.