diff options
Diffstat (limited to 'mod')
-rw-r--r-- | mod/options.cli | 4 | ||||
-rw-r--r-- | mod/types-parsers.cxx | 25 | ||||
-rw-r--r-- | mod/types-parsers.hxx | 9 |
3 files changed, 37 insertions, 1 deletions
diff --git a/mod/options.cli b/mod/options.cli index 33ed9a1..f7a9387 100644 --- a/mod/options.cli +++ b/mod/options.cli @@ -2,6 +2,8 @@ // copyright : Copyright (c) 2014-2018 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file +include <libbpkg/manifest.hxx>; // repository_url + include <web/xhtml-fragment.hxx>; include <libbrep/types.hxx>; @@ -727,7 +729,7 @@ namespace brep { // Package repository URL. // - url repository; + bpkg::repository_url repository; // Package names/versions. // diff --git a/mod/types-parsers.cxx b/mod/types-parsers.cxx index 6b0e721..e40a777 100644 --- a/mod/types-parsers.cxx +++ b/mod/types-parsers.cxx @@ -7,6 +7,7 @@ #include <mod/options.hxx> using namespace std; +using namespace bpkg; using namespace web::xhtml; namespace brep @@ -50,6 +51,30 @@ namespace brep parse_path (x, s); } + // Parse repository_url. + // + void parser<repository_url>:: + parse (repository_url& x, bool& xs, scanner& s) + { + xs = true; + + const char* o (s.next ()); + + if (!s.more ()) + throw missing_value (o); + + const char* v (s.next ()); + + try + { + x = repository_url (v); + } + catch (const invalid_argument&) + { + throw invalid_value (o, v); + } + } + // Parse page_form. // void parser<page_form>:: diff --git a/mod/types-parsers.hxx b/mod/types-parsers.hxx index 4ef06b3..36128d9 100644 --- a/mod/types-parsers.hxx +++ b/mod/types-parsers.hxx @@ -8,6 +8,8 @@ #ifndef MOD_TYPES_PARSERS_HXX #define MOD_TYPES_PARSERS_HXX +#include <libbpkg/manifest.hxx> // repository_url + #include <web/xhtml-fragment.hxx> #include <libbrep/types.hxx> @@ -39,6 +41,13 @@ namespace brep }; template <> + struct parser<bpkg::repository_url> + { + static void + parse (bpkg::repository_url&, bool&, scanner&); + }; + + template <> struct parser<page_form> { static void |