Skip to content

Commit

Permalink
Show installations status for cask dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
HaraldNordgren committed Aug 7, 2024
1 parent 90a90b3 commit 1e7b9f4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
Empty file modified Library/Homebrew/cmd/--env.rb
100644 → 100755
Empty file.
3 changes: 2 additions & 1 deletion Library/Homebrew/cmd/info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
require "keg"
require "tab"
require "json"
require "utils/info"
require "utils/spdx"
require "deprecate_disable"
require "api"
Expand Down Expand Up @@ -320,7 +321,7 @@ def info_formula(formula)
ohai "Dependencies"
%w[build required recommended optional].map do |type|
deps = formula.deps.send(type).uniq
puts "#{type.capitalize}: #{decorate_dependencies deps}" unless deps.empty?
puts "#{type.capitalize}: #{Utils::Info.decorate_dependencies(deps)}" unless deps.empty?
end
end

Expand Down
18 changes: 18 additions & 0 deletions Library/Homebrew/utils/info.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# typed: true
# frozen_string_literal: true

module Utils
# Helper functions for formula and cask info.
module Info
def self.decorate_dependencies(dependencies)
deps_status = dependencies.map do |dep|
if dep.satisfied?([])
pretty_installed(dep_display_s(dep))
else
pretty_uninstalled(dep_display_s(dep))
end
end
deps_status.join(", ")
end
end
end

0 comments on commit 1e7b9f4

Please sign in to comment.