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

Problem with option_value having the same prefix as a command #41

Open
CIDJEY opened this issue Jan 22, 2020 · 1 comment
Open

Problem with option_value having the same prefix as a command #41

CIDJEY opened this issue Jan 22, 2020 · 1 comment

Comments

@CIDJEY
Copy link

CIDJEY commented Jan 22, 2020

I have this code

auto run_spec = "run options" % (
	command("run").set(args.selected_mode, mode::run),
	value("input file or folder", args.target) % "Path to a file",
	(option("--test_spec") & value("wildcard pattern", args.test_spec)) % "Run specific tests"
);
auto cli = ( run_spec | command("help").set(args.show_help) );
if (!parse(argc, argv, cli)) {
	std::cout << make_man_page(cli, "testo") << std::endl;
	return -1;
}

Running like this

program run some_file --test_spec something is totally fine, but

Running like this

program run some_file --test_spec run_something gives me usage lines

@mbessler
Copy link

I've run into the same problem. In my case I have a series of commands defined, and then a help command that takes a value or opt_value. The intent is to get help on the commands. However, if the value is one of the commands I get a parse() error. With other random strings after the help command it's fine.

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

2 participants