mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-13 06:16:55 -04:00
github #5: handle unrecognized command line arguments
This commit is contained in:
parent
9a4ce33477
commit
774ad7cbbf
@ -339,10 +339,19 @@ int mkdwarfs(int argc, char** argv) {
|
||||
// clang-format on
|
||||
|
||||
po::variables_map vm;
|
||||
auto parsed = po::parse_command_line(argc, argv, opts);
|
||||
|
||||
po::store(po::parse_command_line(argc, argv, opts), vm);
|
||||
po::store(parsed, vm);
|
||||
po::notify(vm);
|
||||
|
||||
auto unrecognized =
|
||||
po::collect_unrecognized(parsed.options, po::include_positional);
|
||||
|
||||
if (!unrecognized.empty()) {
|
||||
throw std::runtime_error(
|
||||
"unrecognized argument(s): " + boost::join(unrecognized, " "));
|
||||
}
|
||||
|
||||
if (vm.count("help") or !vm.count("input") or !vm.count("output")) {
|
||||
size_t l_dc = 0, l_sc = 0, l_mc = 0, l_ws = 0;
|
||||
for (auto const& l : levels) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user