From fa9017f87197565b970d22d2d51241fdfa55c916 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 12 Jul 2018 16:59:27 +0300 Subject: Add --manifest option to pkg-verify --- bpkg/pkg-verify.cli | 6 ++++++ bpkg/pkg-verify.cxx | 21 ++++++++++++++++++++- bpkg/rep-info.cli | 2 +- 3 files changed, 27 insertions(+), 2 deletions(-) (limited to 'bpkg') diff --git a/bpkg/pkg-verify.cli b/bpkg/pkg-verify.cli index f4f3214..5432743 100644 --- a/bpkg/pkg-verify.cli +++ b/bpkg/pkg-verify.cli @@ -42,5 +42,11 @@ namespace bpkg declare such a package valid since it cannot be sure the unknown entries are valid." } + + bool --manifest + { + "Instead of printing the successful verification result in the + human-readable form, dump the package manifest to \cb{stdout}." + } }; } diff --git a/bpkg/pkg-verify.cxx b/bpkg/pkg-verify.cxx index 2711394..69014ac 100644 --- a/bpkg/pkg-verify.cxx +++ b/bpkg/pkg-verify.cxx @@ -4,8 +4,11 @@ #include +#include // cout + #include #include +#include #include #include @@ -189,7 +192,23 @@ namespace bpkg package_manifest m ( pkg_verify (o, a, o.ignore_unknown (), !o.silent ())); - if (verb && !o.silent () && !o.no_result ()) + if (o.manifest ()) + { + try + { + manifest_serializer s (cout, "STDOUT"); + m.serialize (s); + } + catch (const manifest_serialization& e) + { + fail << "unable to serialize manifest: " << e.description; + } + catch (const io_error&) + { + fail << "unable to write to STDOUT"; + } + } + else if (verb && !o.silent () && !o.no_result ()) text << "valid package " << m.name << " " << m.version; return 0; diff --git a/bpkg/rep-info.cli b/bpkg/rep-info.cli index 17bf499..35afd55 100644 --- a/bpkg/rep-info.cli +++ b/bpkg/rep-info.cli @@ -85,7 +85,7 @@ namespace bpkg "Print the list of available packages." } - bool --manifest|-m + bool --manifest { "Instead of printing the information in the human-readable form, dump it as manifest(s). Normally you would use this option in combination with -- cgit v1.1