Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Also display installed versions in brew-cask info #12746

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions lib/hbc/cli/info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,24 @@ def self.help
end

def self.info(cask)
out = info_report(cask)
metadata_versions_glob = Pathname.glob(cask.metadata_master_container_path.join('*'))
glob_size = metadata_versions_glob.size
if glob_size > 0 then
out << "\n#{glob_size} locally known version#{glob_size > 1 ? 's' : ''}:\n"
end
metadata_versions_glob.each do |ver_path|
out << "\n"
latest_timespamped_path = Pathname.glob(ver_path.join('*')).sort.last
src_path = latest_timespamped_path.join('Casks').join("#{cask.token}.rb")
out << "#{src_path}\n"
backedup_cask = Hbc::Source.for_query(src_path).load
out << info_report(backedup_cask)
end
out
end

def self.info_report(cask)
installation = if cask.installed?
"#{cask.staged_path} (#{Hbc::Utils.cabv(cask.staged_path)})"
else
Expand Down