cam: options: optional arguments needs to be specified as --foo=bar

It's not stated in the getopt_long documentation but optional arguments
need to be specified as '--foo=bar' instead of '--foo bar', otherwise
the value is not propagated to optarg during argument parsing. Update
the usage printing helper to reflect this requirement.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Niklas Söderlund 2019-01-25 00:15:55 +01:00
parent 71ef5532d9
commit ac0a3d7fb6

View file

@ -143,9 +143,10 @@ void OptionsParser::usage()
}; };
if (option.argument != ArgumentNone) { if (option.argument != ArgumentNone) {
argument += std::string(" ");
if (option.argument == ArgumentOptional) if (option.argument == ArgumentOptional)
argument += "["; argument += "[=";
else
argument += " ";
argument += option.argumentName; argument += option.argumentName;
if (option.argument == ArgumentOptional) if (option.argument == ArgumentOptional)
argument += "]"; argument += "]";