From b13332c991ce2695626eaca367dd8208b174c9ca Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 14 Apr 2016 17:59:24 +0300 Subject: Add support for repository authentication --- bpkg/types-parsers.cxx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'bpkg/types-parsers.cxx') 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:: + 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); + } } } -- cgit v1.1