-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show installations status for cask dependencies
- Loading branch information
1 parent
90a90b3
commit 9926315
Showing
3 changed files
with
26 additions
and
18 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# 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 | ||
|
||
def self.dep_display_s(dep) | ||
return dep.name if dep.option_tags.empty? | ||
|
||
"#{dep.name} #{dep.option_tags.map { |o| "--#{o}" }.join(" ")}" | ||
end | ||
end | ||
end |