CLI11 icon indicating copy to clipboard operation
CLI11 copied to clipboard

Do not interpret options in a multi argument option

Open Firefly35 opened this issue 4 years ago • 1 comments

I'd like to forward an exe line arguments through a program using CLI11. The expected result is:

$ ./my_program run --deps path_to_deps_description_file mycommand --args -f mycommand_file

where --deps and path_to_deps_description_file is an option and its value to the run command, the --args option is a std::vector<std::string> and each value must be put in the vector without interpretation. Currently, -f is interpreted as a CLI11 option and leads to an error.

I tried to put -f between quotes (") but it was also interpreted as an option.

I also tried using a "args" subcommand and get the same error result.

How can I achieve this ?

Firefly35 avatar May 07 '21 12:05 Firefly35

I tried to put -f between quotes (") but it was also interpreted as an option.

The program is not told if something is in quotes by the shell. You can use a "args" subcommand with .prefix_command() activated - that will assume that everything after the command is going to be given to something else. If you set a required argument, then it will be passed in, but there I think you'd need to have --args -f --args mycommand_file. I think a prefix_command would be best if you can go that way.

henryiii avatar Jun 15 '21 16:06 henryiii