From 1fae30f8e1af4b4b5d15e8bbd692968837d3e7fd Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 16 Mar 2018 18:11:55 +0200 Subject: Implement --old-available|-o in pkg-status --- bpkg/pkg-status.cli | 24 +++++++++++++++++------- bpkg/pkg-status.cxx | 24 +++++++++++++++++------- 2 files changed, 34 insertions(+), 14 deletions(-) diff --git a/bpkg/pkg-status.cli b/bpkg/pkg-status.cli index 09c6b2c..d6fafa2 100644 --- a/bpkg/pkg-status.cli +++ b/bpkg/pkg-status.cli @@ -73,21 +73,26 @@ namespace bpkg If only the package name was specified without the package version, then the \cb{available} status word is followed by the list of available - versions. If the \cb{--system} option is specified, then the last version - in this list may have the \cb{sys:} prefix indicating an available system - version. Such a system version may be the special '\cb{?}' value - indicating that a package may or may not be available from the system and - that its version is unknown. + versions. Versions that are only available for up/down-grading are + printed in '\cb{[]}' (such version are only available as dependencies + from prerequisite repositories of other repositories). If the + \cb{--system} option is specified, then the last version in this list may + have the \cb{sys:} prefix indicating an available system version. Such a + system version may be the special '\cb{?}' value indicating that a + package may or may not be available from the system and that its version + is unknown. Similarly, if only the package name was specified, then the \cb{fetched}, \cb{unpacked}, \cb{configured}, and \cb{broken} status words are followed by the version of the package. If newer versions are available, then the package version is followed by the \cb{available} status word and the - list of newer versions. + list of newer versions. To instead see a list of all versions, including + the older ones, specify the \c{\b{--old-available}|\b{-o}} option. In + this case the currently selected version is printed in '\cb{()}'. If the package name was specified with the version, then only the status (such as, \cb{configured}, \cb{available}, etc.) of this version is - printed. + considered. If a package is being held, then its name is printed prefixed with '\cb{!}'. Similarly, if a package version is being held, then the version @@ -159,6 +164,11 @@ namespace bpkg "Also print the status of all dependencies, recursively." } + bool --old-available|-o + { + "Print old available versions." + } + bool --constraint { "Print version constraints for dependencies." diff --git a/bpkg/pkg-status.cxx b/bpkg/pkg-status.cxx index a93322e..8250766 100644 --- a/bpkg/pkg-status.cxx +++ b/bpkg/pkg-status.cxx @@ -90,11 +90,13 @@ namespace bpkg false); // And if we found an existing package, then only look for versions - // greater than to what already exists. Note that for a system - // wildcard version we will always show all available versions - // (since it's 0). + // greater than to what already exists unless we were asked to show + // old versions. // - if (s != nullptr) + // Note that for a system wildcard version we will always show all + // available versions (since it is 0). + // + if (s != nullptr && !o.old_available ()) q = q && query::id.version > s->version; q += order_by_version_desc (query::id.version); @@ -188,10 +190,18 @@ namespace bpkg cout << (s != nullptr ? " " : "") << "available"; for (const apkg& a: apkgs) + { + const version& v (a.package->version); + + // Show the currently selected version in parenthesis. + // + bool cur (s != nullptr && v == s->version); + cout << ' ' - << (a.build ? "" : "[") - << a.package->version - << (a.build ? "" : "]"); + << (cur ? "(" : a.build ? "" : "[") + << v + << (cur ? ")" : a.build ? "" : "]"); + } if (!sys.empty ()) cout << ' ' -- cgit v1.1