aboutsummaryrefslogtreecommitdiff
path: root/bpkg/pkg-status.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-03-16 18:11:55 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-03-16 18:11:55 +0200
commit1fae30f8e1af4b4b5d15e8bbd692968837d3e7fd (patch)
tree5dde19a88d7ff3a4a37b7688d6142c982800b503 /bpkg/pkg-status.cxx
parentad2712d8a1e22253cddc7fd71cc7700933040dcb (diff)
Implement --old-available|-o in pkg-status
Diffstat (limited to 'bpkg/pkg-status.cxx')
-rw-r--r--bpkg/pkg-status.cxx24
1 files changed, 17 insertions, 7 deletions
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 << ' '