From 4476d9d02ac7af21a7bc6ef92490491d308237f4 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 29 Apr 2020 22:20:21 +0300 Subject: Add --pkg-proxy common option --- bpkg/types-parsers.cxx | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'bpkg/types-parsers.cxx') 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:: + 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 static void parse_path (T& x, scanner& s) -- cgit v1.1