diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2016-04-14 17:59:24 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2016-05-04 20:47:45 +0300 |
commit | b13332c991ce2695626eaca367dd8208b174c9ca (patch) | |
tree | 809dc321b47d5ef9c72935637f94bf5b84ed640d /bpkg/types-parsers.cxx | |
parent | c9831f760a83e36a3a2ac84b1bd3f573e47ef195 (diff) |
Add support for repository authentication
Diffstat (limited to 'bpkg/types-parsers.cxx')
-rw-r--r-- | bpkg/types-parsers.cxx | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/bpkg/types-parsers.cxx b/bpkg/types-parsers.cxx index 9e97ccd..6a61a3d 100644 --- a/bpkg/types-parsers.cxx +++ b/bpkg/types-parsers.cxx @@ -47,5 +47,25 @@ namespace bpkg xs = true; parse_path (x, s); } + + void parser<auth>:: + parse (auth& x, bool& xs, scanner& s) + { + xs = true; + const char* o (s.next ()); + + if (!s.more ()) + throw missing_value (o); + + const string v (s.next ()); + if (v == "none") + x = auth::none; + else if (v == "remote") + x = auth::remote; + else if (v == "all") + x = auth::all; + else + throw invalid_value (o, v); + } } } |