summaryrefslogtreecommitdiff
path: root/src/cam/options.cpp
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-07-06 06:56:19 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-07-22 17:13:20 +0300
commita8f3a68ec91bd84ea481ea7ac2fba02b3846d6ab (patch)
treee1bb3c16106efd0b8df727df67b0aa7e1bc17f30 /src/cam/options.cpp
parent7c205c79d9284599601fa91c87282f416e53f8dc (diff)
cam: options: Slit OptionsParser::usage() in two functions
To prepare for code reuse, split the printing of options out of OptionsParser::usage() to a separate function. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src/cam/options.cpp')
-rw-r--r--src/cam/options.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/cam/options.cpp b/src/cam/options.cpp
index 721a808a..350c8084 100644
--- a/src/cam/options.cpp
+++ b/src/cam/options.cpp
@@ -902,8 +902,6 @@ OptionsParser::Options OptionsParser::parse(int argc, char **argv)
*/
void OptionsParser::usage()
{
- std::cerr << "Options:" << std::endl;
-
unsigned int indent = 0;
for (const Option &option : options_) {
@@ -923,7 +921,15 @@ void OptionsParser::usage()
indent = (indent + 7) / 8 * 8;
- for (const Option &option : options_) {
+ std::cerr << "Options:" << std::endl;
+
+ usageOptions(options_, indent);
+}
+
+void OptionsParser::usageOptions(const std::list<Option> &options,
+ unsigned int indent)
+{
+ for (const Option &option : options) {
std::string argument;
if (option.hasShortOption())
argument = std::string(" -")