Comments (2)
Can you provide a code snippet so I can reproduce the core dump? Please explain what you mean by "but don't define how to handle it"
from argparse.
This is the code that I am using. If I pass "-o" and nothing else, I get a core dump
argparse::ArgumentParser bfm("bfm");
bfm.add_argument("-l","--load")
.help("load a VMM into the kernel");
bfm.add_argument("-x", "--start")
.default_value(false)
.implicit_value(true)
.help("start a previously loaded VMM");
bfm.add_argument("-d", "--dump")
.default_value(false)
.implicit_value(true)
.help("output the contents of the VMM's debug buffer");
bfm.add_argument("-s", "--stop")
.default_value(false)
.implicit_value(true)
.help("stop a previously started VMM");
bfm.add_argument("-u", "--unload")
.default_value(false)
.implicit_value(true)
.help("unload a previously loaded VMM");
bfm.add_argument("-m", "--mem")
.default_value(64ULL)
.action([](const std::string& val) { return std::stoull(val); })
.help("memory in MB to give the VMM when loading");
bfm.parse_args(argc, argv);
if (!bfm.get<std::string>("--load").empty()) {
this->load_vmm(
bfm.get<std::string>("--load"),
bfm.get<unsigned long long>("--mem")
);
}
if (bfm.get<bool>("--start")) {
this->start_vmm();
}
if (bfm.get<bool>("--dump")) {
this->dump_vmm();
}
if (bfm.get<bool>("--stop")) {
this->stop_vmm();
}
if (bfm.get<bool>("--unload")) {
this->unload_vmm();
}
from argparse.
Related Issues (20)
- Customize argument priority check
- Detect unknown subcommand HOT 1
- compiler complains line 686 when --Wall enabled HOT 2
- User-overridable implicit value for option HOT 2
- Adding mutually exclusive arguments HOT 1
- Report which option generates error HOT 6
- Unexpected behavior when using choices()
- Add custom help for mutually_exclusive arguments
- Ability to support defining K/V dictionary via arguments HOT 4
- [Windows] space in arg value between double quote are splitted like it was different arg HOT 1
- Support boolean argument with the form like '--enable-hack=true/false' HOT 3
- m_is_used not updated in parent of subcommand
- Segmentation fault on splitting string with .action HOT 3
- add_mutually_exclusive_group required in parent parser are not validated
- Support prefix style arguments
- mutually_exclusive arguments should able to add existing arguments.
- Incorrect help message for argparse::nargs_pattern::at_least_one HOT 1
- choices() method not working properly HOT 2
- mutually_exclusive_group should also checked in parse_known_args
- is_subcommand_used doesn't work if same argument is added to parent and child
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 argparse.