summaryrefslogtreecommitdiff
path: root/src/lib/create_cli.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/create_cli.cc')
-rw-r--r--src/lib/create_cli.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/lib/create_cli.cc b/src/lib/create_cli.cc
index 3fb978f7c..10196199a 100644
--- a/src/lib/create_cli.cc
+++ b/src/lib/create_cli.cc
@@ -28,6 +28,7 @@
#include "ratio.h"
#include "variant.h"
#include <dcp/raw_convert.h>
+#include <fmt/format.h>
#include <iostream>
#include <string>
@@ -88,6 +89,25 @@ argument_option (int& n, int argc, char* argv[], string short_name, string long_
}
+template <>
+void
+argument_option(int& n, int argc, char* argv[], string short_name, string long_name, bool* claimed, optional<string>* error, string* out)
+{
+ string const a = argv[n];
+ if (a != short_name && a != long_name) {
+ return;
+ }
+
+ if ((n + 1) >= argc) {
+ **error = String::compose("%1: option %2 requires an argument", argv[0], long_name);
+ return;
+ }
+
+ *out = string(argv[++n]);
+ *claimed = true;
+}
+
+
template <class T>
void
argument_option (