[libcamera-devel] [PATCH] cam: options: Indent multi-line help message correctly
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Sat Jan 26 16:16:59 CET 2019
Split multi-line help messages and indent all lines the same way.
Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
src/cam/options.cpp | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/cam/options.cpp b/src/cam/options.cpp
index 55c42540f924..83601270207b 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;
+ }
+ }
}
}
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list