Class: Cask::List
Class Method Summary collapse
- .format_versioned(cask) ⇒ String private
- .list_artifacts(cask) ⇒ void private
- .list_casks(*casks, one: false, full_name: false, versions: false) ⇒ void private
Class Method Details
.format_versioned(cask) ⇒ String
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
47 48 49 |
# File 'cask/list.rb', line 47 def self.format_versioned(cask) "#{cask}#{cask.installed_version&.prepend(" ")}" end |
.list_artifacts(cask) ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
This method returns an undefined value.
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'cask/list.rb', line 32 def self.list_artifacts(cask) cask.artifacts.group_by(&:class).sort_by { |klass, _| klass.english_name }.each do |klass, artifacts| next if [Artifact::Uninstall, Artifact::Zap].include? klass ohai klass.english_name artifacts.each do |artifact| puts artifact.summarize_installed if artifact.respond_to?(:summarize_installed) next if artifact.respond_to?(:summarize_installed) puts artifact end end end |
.list_casks(*casks, one: false, full_name: false, versions: false) ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
This method returns an undefined value.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'cask/list.rb', line 9 def self.list_casks(*casks, one: false, full_name: false, versions: false) output = if casks.any? casks.each do |cask| raise CaskNotInstalledError, cask unless cask.installed? end else Caskroom.casks end if one puts output.map(&:to_s) elsif full_name puts output.map(&:full_name).sort(&tap_and_name_comparison) elsif versions puts output.map { format_versioned(_1) } elsif !output.empty? && casks.any? output.map { list_artifacts(_1) } elsif !output.empty? puts Formatter.columns(output.map(&:to_s)) end end |