summaryrefslogtreecommitdiff
path: root/src/cam
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
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')
-rw-r--r--src/cam/options.cpp12
-rw-r--r--src/cam/options.h2
2 files changed, 11 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(" -")
diff --git a/src/cam/options.h b/src/cam/options.h
index 0b8bb172..01a5d36a 100644
--- a/src/cam/options.h
+++ b/src/cam/options.h
@@ -95,6 +95,8 @@ public:
void usage();
private:
+ void usageOptions(const std::list<Option> &options, unsigned int indent);
+
std::list<Option> options_;
std::map<unsigned int, Option *> optionsMap_;
};