Class: Homebrew::Cmd::List Private
- Inherits:
-
AbstractCommand
- Object
- AbstractCommand
- Homebrew::Cmd::List
- Includes:
- SystemCommand::Mixin
- Defined in:
- sorbet/rbi/dsl/homebrew/cmd/list.rbi,
cmd/list.rb
Overview
This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.
DO NOT EDIT MANUALLY
This is an autogenerated file for dynamic methods in Homebrew::Cmd::List
.
Please instead update this file by running bin/tapioca dsl Homebrew::Cmd::List
.
Defined Under Namespace
Classes: Args
Instance Method Summary collapse
- #args ⇒ Homebrew::Cmd::List::Args private
- #run ⇒ void private
Methods included from SystemCommand::Mixin
#system_command, #system_command!
Methods inherited from AbstractCommand
command, command_name, dev_cmd?, #initialize, parser
Constructor Details
This class inherits a constructor from Homebrew::AbstractCommand
Instance Method Details
#args ⇒ Homebrew::Cmd::List::Args
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.
9 |
# File 'sorbet/rbi/dsl/homebrew/cmd/list.rbi', line 9 def args; end |
#run ⇒ 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.
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
# File 'cmd/list.rb', line 82 def run if args.full_name? unless args.cask? formula_names = args.no_named? ? Formula.installed : args.named.to_resolved_formulae full_formula_names = formula_names.map(&:full_name).sort(&tap_and_name_comparison) full_formula_names = Formatter.columns(full_formula_names) unless args.public_send(:"1?") puts full_formula_names if full_formula_names.present? end if args.cask? || (!args.formula? && args.no_named?) cask_names = if args.no_named? Cask::Caskroom.casks else args.named.to_formulae_and_casks(only: :cask, method: :resolve) end # The cast is because `Keg`` does not define `full_name` full_cask_names = T.cast(cask_names, T::Array[T.any(Formula, Cask::Cask)]) .map(&:full_name).sort(&tap_and_name_comparison) full_cask_names = Formatter.columns(full_cask_names) unless args.public_send(:"1?") puts full_cask_names if full_cask_names.present? end elsif args.pinned? filtered_list elsif args.versions? filtered_list unless args.cask? list_casks if args.cask? || (!args.formula? && !args.multiple? && args.no_named?) elsif args.installed_on_request? || args.installed_as_dependency? unless args.no_named? raise UsageError, "Cannot use `--installed-on-request` or " \ "`--installed-as-dependency` with formula arguments." end Formula.installed.sort.each do |formula| tab = Tab.for_formula(formula) if args.installed_on_request? && args.installed_as_dependency? statuses = [] statuses << "installed on request" if tab.installed_on_request statuses << "installed as dependency" if tab.installed_as_dependency next if statuses.empty? puts "#{formula.name}: #{statuses.join(", ")}" elsif (args.installed_on_request? && tab.installed_on_request) || (args.installed_as_dependency? && tab.installed_as_dependency) puts formula.name end end elsif args.no_named? ENV["CLICOLOR"] = nil ls_args = [] ls_args << "-1" if args.public_send(:"1?") ls_args << "-l" if args.l? ls_args << "-r" if args.r? ls_args << "-t" if args.t? if !args.cask? && HOMEBREW_CELLAR.exist? && HOMEBREW_CELLAR.children.any? ohai "Formulae" if $stdout.tty? && !args.formula? safe_system "ls", *ls_args, HOMEBREW_CELLAR puts if $stdout.tty? && !args.formula? end if !args.formula? && Cask::Caskroom.any_casks_installed? ohai "Casks" if $stdout.tty? && !args.cask? safe_system "ls", *ls_args, Cask::Caskroom.path end else kegs, casks = args.named.to_kegs_to_casks if args.verbose? || !$stdout.tty? find_args = %w[-not -type d -not -name .DS_Store -print] system_command! "find", args: kegs.map(&:to_s) + find_args, print_stdout: true if kegs.present? system_command! "find", args: casks.map(&:caskroom_path) + find_args, print_stdout: true if casks.present? else kegs.each { |keg| PrettyListing.new keg } if kegs.present? list_casks if casks.present? end end end |