imdsd uses --extra-header='NAME: VALUE'. We could include the quotes
in the metavar string, but I think it's nicer to only do that in the
printed output, so that later, when we add introspection, the value
there will not include the quotes.
* "=" is shown only when a long option is defined: -l --long=ARG, --long=ARG, -s ARG.
*/
bool need_eq = option_takes_arg(opt) && opt->long_code;
+ bool need_quote = opt->metavar && strchr(opt->metavar, ' ');
_cleanup_free_ char *s = strjoin(
" ",
sc,
strempty(opt->long_code),
option_arg_optional(opt) ? "[" : "",
need_eq ? "=" : "",
+ need_quote ? "'" : "",
strempty(opt->metavar),
+ need_quote ? "'" : "",
option_arg_optional(opt) ? "]" : "");
if (!s)
return log_oom();