aboutsummaryrefslogtreecommitdiff
path: root/bpkg/types-parsers.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'bpkg/types-parsers.cxx')
-rw-r--r--bpkg/types-parsers.cxx22
1 files changed, 22 insertions, 0 deletions
diff --git a/bpkg/types-parsers.cxx b/bpkg/types-parsers.cxx
index ce3cd0c..be95219 100644
--- a/bpkg/types-parsers.cxx
+++ b/bpkg/types-parsers.cxx
@@ -7,6 +7,28 @@ namespace bpkg
{
namespace cli
{
+ void parser<url>::
+ parse (url& x, bool& xs, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (!s.more ())
+ throw missing_value (o);
+
+ const char* v (s.next ());
+
+ try
+ {
+ x = url (v);
+ }
+ catch (const invalid_argument& e)
+ {
+ throw invalid_value (o, v, e.what ());
+ }
+
+ xs = true;
+ }
+
template <typename T>
static void
parse_path (T& x, scanner& s)