diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2020-04-29 22:20:21 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2020-05-01 18:10:37 +0300 |
commit | 4476d9d02ac7af21a7bc6ef92490491d308237f4 (patch) | |
tree | 78fe722595c6303c244a9dc421ce6c15d2165fb6 /bpkg/types-parsers.cxx | |
parent | ef30db48d9a910fa06a94a07d231f32a8fce0e46 (diff) |
Add --pkg-proxy common option
Diffstat (limited to 'bpkg/types-parsers.cxx')
-rw-r--r-- | bpkg/types-parsers.cxx | 22 |
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) |