Class: Homebrew::Cmd::TabCmd Private

Inherits:
AbstractCommand show all
Defined in:
cmd/tab.rb,
sorbet/rbi/dsl/homebrew/cmd/tab_cmd.rbi

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.

Defined Under Namespace

Classes: Args

Instance Method Summary collapse

Methods inherited from AbstractCommand

command, command_name, dev_cmd?, #initialize, parser, ruby_cmd?

Constructor Details

This class inherits a constructor from Homebrew::AbstractCommand

Instance Method Details

#argsHomebrew::Cmd::TabCmd::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.



10
# File 'sorbet/rbi/dsl/homebrew/cmd/tab_cmd.rbi', line 10

def args; end

#runvoid

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.

Raises:



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'cmd/tab.rb', line 37

def run
  installed_on_request = if args.installed_on_request?
    true
  elsif args.no_installed_on_request?
    false
  end
  raise UsageError, "No marking option specified." if installed_on_request.nil?

  formulae, casks = args.named.to_formulae_to_casks
  formulae_not_installed = formulae.reject(&:any_version_installed?)
  casks_not_installed = casks.reject(&:installed?)
  if formulae_not_installed.any? || casks_not_installed.any?
    names = formulae_not_installed.map(&:name) + casks_not_installed.map(&:token)
    is_or_are = (names.length == 1) ? "is" : "are"
    odie "#{names.to_sentence} #{is_or_are} not installed."
  end

  [*formulae, *casks].each do |formula_or_cask|
    update_tab formula_or_cask, installed_on_request:
  end
end