Comments (5)
It's smarter to keep RuntimeError and ParseError siblings, so that's what I did in #45.
from cli11.
Two initial thoughts:
- This really makes
CLI11_PARSE
the recommended/required way to exit. For someone not usingCLI11_PARSE
, you should be able to do:
try {
app.parse(argc, argv);
} catch (const CLI::Error &e) {
return app.exit(e);
}
(I'm okay if CLI::ParseError
isn't enough)
It might make sense to moveNo, I think it works fine as is.CLI::Success
to aCLI::RuntimeError
too.
I'll probably push to the PR in a minute.
from cli11.
That's ok. I was worried that catching CLI::Error is too grabby, because the other errors are more like programming errors (such as adding options twice), which I thought CLI11_PARSE doesn't catch purposefully. Thanks!
from cli11.
The other errors cannot be thrown from .parse
, though sometimes users wrap too much in the try block. I think leaving CLI11_PARSE
as less grabby is a good idea, but direct usage should be at least possible catching CLI::Error
.
from cli11.
I've made RuntimeError
a ParseError
, since it can only happen at parse time, and will leave the Error
catching as ParseError
catching. This has the smallest API change.
from cli11.
Related Issues (20)
- [Precompiled] No symbols in library HOT 1
- [CMake] CLI11_BUILD_DOCS=ON does not generate the documentation with Doxygen HOT 3
- Positional is treated as a sub-command HOT 4
- Fix envname with validator bug introduced in v2.4.0 HOT 3
- Question: Option requires one of two other options HOT 3
- Explicit boolean option parsed into std::optional HOT 2
- widen convert faild in Windows HOT 3
- When I use add_option_group, some redundant information will be displayed in the 'help message'.
- When I use add_option_group, some redundant information will be displayed in the 'help message'.
- When I use add_option_group, some redundant information will be displayed in the 'help message'.
- Access violation crash when using subcomands callbacks HOT 3
- New error after updating to 2.4.2: add_option throws error when adding option "--h" HOT 9
- Access violation crash when add subcommand in seperate function HOT 2
- prefix_command documentation is confusing and should be reworded HOT 9
- MSVC error LNK2019: unresolved external symbol __imp_CommandLineToArgvW referenced in function CLI::detail::compute_win32_argv(void)
- set_config() on a subcommand CLI::App* HOT 2
- How to get the last argument without option? (like the basic "ls" command) HOT 2
- Print argv from a callback HOT 2
- linker error when CLI.hpp not included HOT 3
- CLI::ExistingDirectory falsely failing with unicode file path HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cli11.