convert_extra_arg_val

Function convert_extra_arg_val 

Source
pub fn convert_extra_arg_val(args: &ArgMatches) -> Vec<String>
Expand description

Converts the parsed value of the --extra-arg option into an optional vector of strings.

This is for adapting to 2 scenarios where --extra-arg is either

  • specified multiple times
    • each val is appended to a Vec (by clap crate)
  • specified once with multiple space-separated values
    • resulting Vec is made from splitting at the spaces between
  • not specified at all (returns None)

It is preferred that the values specified in either situation do not contain spaces and are quoted:

--extra-arg="-std=c++17" --extra-arg="-Wall"
# or equivalently
--extra-arg="-std=c++17 -Wall"

The cpp-linter-action (for Github CI workflows) can only use 1 extra-arg input option, so the value will be split at spaces.