Message ID | 20190125174254.11890-1-niklas.soderlund@ragnatech.se |
---|---|
State | Accepted |
Commit | ac0a3d7fb678cc35857d3e4a49bedd6a7d69b57c |
Headers | show |
Series |
|
Related | show |
Hi Niklas, Thank you for the patch. On Fri, Jan 25, 2019 at 06:42:54PM +0100, Niklas Söderlund wrote: > It's not state in the documentation but optional arguments needs to be s/state/stated/ s/documentation/getopt_long documentation/ s/needs/need/ > specified using as '--foo=bar' instead of '--foo bar', otherwise the s/using as/as/ > 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> > --- > src/cam/options.cpp | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/src/cam/options.cpp b/src/cam/options.cpp > index 82acff9bbeea476d..55c42540f92478e6 100644 > --- a/src/cam/options.cpp > +++ b/src/cam/options.cpp > @@ -143,9 +143,10 @@ void OptionsParser::usage() > }; > > if (option.argument != ArgumentNone) { > - argument += std::string(" "); > if (option.argument == ArgumentOptional) > - argument += "["; > + argument += "[="; > + else > + argument += " "; > argument += option.argumentName; > if (option.argument == ArgumentOptional) > argument += "]";
Hi, On 2019-01-25 23:49:35 +0200, Laurent Pinchart wrote: > Hi Niklas, > > Thank you for the patch. > > On Fri, Jan 25, 2019 at 06:42:54PM +0100, Niklas Söderlund wrote: > > It's not state in the documentation but optional arguments needs to be > > s/state/stated/ > s/documentation/getopt_long documentation/ > s/needs/need/ > > > specified using as '--foo=bar' instead of '--foo bar', otherwise the > > s/using as/as/ > > > 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> With the changes above pushed to master. > > > --- > > src/cam/options.cpp | 5 +++-- > > 1 file changed, 3 insertions(+), 2 deletions(-) > > > > diff --git a/src/cam/options.cpp b/src/cam/options.cpp > > index 82acff9bbeea476d..55c42540f92478e6 100644 > > --- a/src/cam/options.cpp > > +++ b/src/cam/options.cpp > > @@ -143,9 +143,10 @@ void OptionsParser::usage() > > }; > > > > if (option.argument != ArgumentNone) { > > - argument += std::string(" "); > > if (option.argument == ArgumentOptional) > > - argument += "["; > > + argument += "[="; > > + else > > + argument += " "; > > argument += option.argumentName; > > if (option.argument == ArgumentOptional) > > argument += "]"; > > -- > Regards, > > Laurent Pinchart
diff --git a/src/cam/options.cpp b/src/cam/options.cpp index 82acff9bbeea476d..55c42540f92478e6 100644 --- a/src/cam/options.cpp +++ b/src/cam/options.cpp @@ -143,9 +143,10 @@ void OptionsParser::usage() }; if (option.argument != ArgumentNone) { - argument += std::string(" "); if (option.argument == ArgumentOptional) - argument += "["; + argument += "[="; + else + argument += " "; argument += option.argumentName; if (option.argument == ArgumentOptional) argument += "]";
It's not state in the documentation but optional arguments needs to be specified using 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> --- src/cam/options.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)