From aae0b7ffb1123103f162bdf566e2d4bce5cbf774 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sat, 26 Jan 2019 17:15:23 +0200 Subject: cam: options: Indent multi-line help message correctly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Split multi-line help messages and indent all lines the same way. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- src/cam/options.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src') 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; + } + } } } -- cgit v1.2.1