From befb8fe6b70ae33155811b537b555e4433aed790 Mon Sep 17 00:00:00 2001 From: "Satadru Pramanik, DO, MPH, MEng" Date: Fri, 3 Oct 2025 15:13:00 -0400 Subject: [PATCH] Add crew version command to get versions of packages. (#13027) * Add crew version command to get versions of packages. Signed-off-by: Satadru Pramanik * bump version Signed-off-by: Satadru Pramanik * Add to Readme. Signed-off-by: Satadru Pramanik --------- Signed-off-by: Satadru Pramanik --- README.md | 1 + bin/crew | 14 +++++++++++++- lib/const.rb | 3 ++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 93aa6a383..c9115e0e8 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,7 @@ Where available commands are: | upgrade | update all or specific package(s) | | upload | upload binaries for all or specific package(s) | | upstream | check if an upstream version is available for package(s) | +| version | check for the Chromebrew version, or if a package is specified, the package version | | whatprovides | regex search for package(s) that contains file(s) | Available packages are listed in the [packages directory](https://github.com/chromebrew/chromebrew/tree/master/packages). diff --git a/bin/crew b/bin/crew index 673d17502..7291eda13 100755 --- a/bin/crew +++ b/bin/crew @@ -46,7 +46,7 @@ begin rescue Docopt::Exit => e if ARGV[0] case ARGV[0] - when '-V', '--version', 'version' + when '-V', '--version' puts CREW_VERSION exit 0 when '-L', '--license', 'license' @@ -2046,6 +2046,18 @@ def upstream_command(args) end end +def version_command(args) + args = { '' => args.split } if args.is_a? String + if args[''].empty? + puts CREW_VERSION + else + args[''].each do |name| + search name + puts @pkg.version + end + end +end + def whatprovides_command(args) args[''].each do |regex| Command.whatprovides(regex) diff --git a/lib/const.rb b/lib/const.rb index c33010e5e..04e786c26 100644 --- a/lib/const.rb +++ b/lib/const.rb @@ -4,7 +4,7 @@ require 'etc' require 'open3' OLD_CREW_VERSION ||= defined?(CREW_VERSION) ? CREW_VERSION : '1.0' -CREW_VERSION ||= '1.67.3' unless defined?(CREW_VERSION) && CREW_VERSION == OLD_CREW_VERSION +CREW_VERSION ||= '1.67.4' unless defined?(CREW_VERSION) && CREW_VERSION == OLD_CREW_VERSION # Kernel architecture. KERN_ARCH ||= Etc.uname[:machine] @@ -466,6 +466,7 @@ CREW_DOCOPT ||= <<~DOCOPT crew upgrade [options] [-f|--force] [-k|--keep] [-s|--source] [-v|--verbose] [ ...] crew upload [options] [-f|--force] [-v|--verbose] [ ...] crew upstream [options] [-j|--json|-u|--update-package-files|-v|--verbose] ... + crew version [options] [] crew whatprovides [options] ... -b --include-build-deps Include build dependencies in output.