diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2022-03-04 17:19:18 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2022-03-04 17:20:36 +0300 |
commit | 8ff6314283396a60ae9806a03f1c017bdc3ec4cc (patch) | |
tree | ddc3aea79452773b8134fab1266a9ce899c32d96 /bpkg/types-parsers.cxx | |
parent | 8dcd798f784ee4eecbca7e13370149440b206a3e (diff) |
Add support for --stdout-format to pkg-status command
Diffstat (limited to 'bpkg/types-parsers.cxx')
-rw-r--r-- | bpkg/types-parsers.cxx | 18 |
1 files changed, 18 insertions, 0 deletions
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<stdout_format>:: + 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<repository_type>:: parse (repository_type& x, bool& xs, scanner& s) { |