summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibCore
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Libraries/LibCore')
-rw-r--r--Userland/Libraries/LibCore/ArgsParser.cpp15
-rw-r--r--Userland/Libraries/LibCore/ArgsParser.h1
2 files changed, 16 insertions, 0 deletions
diff --git a/Userland/Libraries/LibCore/ArgsParser.cpp b/Userland/Libraries/LibCore/ArgsParser.cpp
index 2988189906..db1ec8d5e7 100644
--- a/Userland/Libraries/LibCore/ArgsParser.cpp
+++ b/Userland/Libraries/LibCore/ArgsParser.cpp
@@ -595,4 +595,19 @@ void ArgsParser::add_positional_argument(Vector<String>& values, const char* hel
add_positional_argument(move(arg));
}
+void ArgsParser::add_positional_argument(Vector<StringView>& values, char const* help_string, char const* name, Required required)
+{
+ Arg arg {
+ help_string,
+ name,
+ required == Required::Yes ? 1 : 0,
+ INT_MAX,
+ [&values](char const* s) {
+ values.append(s);
+ return true;
+ }
+ };
+ add_positional_argument(move(arg));
+}
+
}
diff --git a/Userland/Libraries/LibCore/ArgsParser.h b/Userland/Libraries/LibCore/ArgsParser.h
index 538e3f9d59..9c0998968b 100644
--- a/Userland/Libraries/LibCore/ArgsParser.h
+++ b/Userland/Libraries/LibCore/ArgsParser.h
@@ -87,6 +87,7 @@ public:
void add_positional_argument(double& value, const char* help_string, const char* name, Required required = Required::Yes);
void add_positional_argument(Vector<const char*>& value, const char* help_string, const char* name, Required required = Required::Yes);
void add_positional_argument(Vector<String>& value, const char* help_string, const char* name, Required required = Required::Yes);
+ void add_positional_argument(Vector<StringView>& value, char const* help_string, char const* name, Required required = Required::Yes);
private:
Vector<Option> m_options;