diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2019-01-26 17:15:23 +0200 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2019-01-27 17:50:29 +0200 |
commit | aae0b7ffb1123103f162bdf566e2d4bce5cbf774 (patch) | |
tree | 7cee2cabbf15fa14e49d9aa2a4ec4a274d935ae9 /src/cam | |
parent | 825bee2d112217c39f1bf4782a1f5fe359a83a28 (diff) |
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>
Diffstat (limited to 'src/cam')
-rw-r--r-- | src/cam/options.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/cam/options.cpp b/src/cam/options.cpp index 55c42540..83601270 100644 --- a/src/cam/options.cpp +++ b/src/cam/options.cpp @@ -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; + } + } } } |