Skip to content
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

Why doesn't allow_unregistered work for me? #113

Open
KOLANICH opened this issue Oct 20, 2021 · 0 comments
Open

Why doesn't allow_unregistered work for me? #113

KOLANICH opened this issue Oct 20, 2021 · 0 comments

Comments

@KOLANICH
Copy link

KOLANICH commented Oct 20, 2021

I still get too many positional options have been specified on the command line on run()

The excerpt

boost::program_options::variables_map vm;
try{
	auto parsed = boost::program_options::command_line_parser(rawArgs.argc, rawArgs.argv).options(oDesc).positional(pd).allow_unregistered().run();  //too many positional options have been specified on the command line
	boost::program_options::store(parsed, vm);
	boost::program_options::notify(vm);
	auto rest = boost::program_options::collect_unrecognized(parsed.options, boost::program_options::collect_unrecognized_mode::include_positional);
} catch(std::exception &ex) {
	PROCESS_CASE_OF_SYNTAX_ERROR_WHATABLE_EXCEPTION(ex);
}

The full source is here: https://github.com/HydrArgs/HydrArgs/blob/master/backends/BoostArgs.cpp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant