clipp icon indicating copy to clipboard operation
clipp copied to clipboard

Problem with option_value having the same prefix as a command

Open CIDJEY opened this issue 6 years ago • 1 comments

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

CIDJEY avatar Jan 22 '20 11:01 CIDJEY

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.

mbessler avatar Feb 10 '20 20:02 mbessler