cam: options: Indent multi-line help message correctly
Split multi-line help messages and indent all lines the same way. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
parent
825bee2d11
commit
aae0b7ffb1
1 changed files with 11 additions and 1 deletions
|
@ -153,7 +153,17 @@ void OptionsParser::usage()
|
|||
}
|
||||
|
||||
std::cerr << std::setw(indent) << std::left << argument;
|
||||
std::cerr << option.help << std::endl;
|
||||
|
||||
for (const char *help = option.help, *end = help; end; ) {
|
||||
end = strchr(help, '\n');
|
||||
if (end) {
|
||||
std::cerr << std::string(help, end - help + 1);
|
||||
std::cerr << std::setw(indent) << " ";
|
||||
help = end + 1;
|
||||
} else {
|
||||
std::cerr << help << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue