From 8ff6314283396a60ae9806a03f1c017bdc3ec4cc Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 4 Mar 2022 17:19:18 +0300 Subject: Add support for --stdout-format to pkg-status command --- bpkg/types-parsers.cxx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'bpkg/types-parsers.cxx') diff --git a/bpkg/types-parsers.cxx b/bpkg/types-parsers.cxx index 97ebafe..e27f050 100644 --- a/bpkg/types-parsers.cxx +++ b/bpkg/types-parsers.cxx @@ -141,6 +141,24 @@ namespace bpkg throw invalid_value (o, v); } + void parser:: + parse (stdout_format& 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 == "lines") + x = stdout_format::lines; + else if (v == "json") + x = stdout_format::json; + else + throw invalid_value (o, v); + } + void parser:: parse (repository_type& x, bool& xs, scanner& s) { -- cgit v1.1