Class: Homebrew::Cmd::SearchCmd Private

Inherits:
AbstractCommand show all
Defined in:
cmd/search.rb,
sorbet/rbi/dsl/homebrew/cmd/search_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

Constant Summary collapse

PACKAGE_MANAGERS =

This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.

{
  repology:  ->(query) { "https://repology.org/projects/?search=#{query}" },
  macports:  ->(query) { "https://ports.macports.org/search/?q=#{query}" },
  fink:      ->(query) { "https://pdb.finkproject.org/pdb/browse.php?summary=#{query}" },
  opensuse:  ->(query) { "https://software.opensuse.org/search?q=#{query}" },
  fedora:    ->(query) { "https://packages.fedoraproject.org/search?query=#{query}" },
  archlinux: ->(query) { "https://archlinux.org/packages/?q=#{query}" },
  debian:    lambda { |query|
    "https://packages.debian.org/search?keywords=#{query}&searchon=names&suite=all&section=all"
  },
  ubuntu:    lambda { |query|
    "https://packages.ubuntu.com/search?keywords=#{query}&searchon=names&suite=all&section=all"
  },
}.freeze

Instance Method Summary collapse

Methods inherited from AbstractCommand

command, command_name, dev_cmd?, #initialize, parser, #raise_sh_command_error!

Constructor Details

This class inherits a constructor from Homebrew::AbstractCommand

Instance Method Details

#argsHomebrew::Cmd::SearchCmd::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/search_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.



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'cmd/search.rb', line 66

def run
  return if search_package_manager

  query = args.named.join(" ")
  string_or_regex = Search.query_regexp(query)

  if args.desc?
    if !args.eval_all? && !Homebrew::EnvConfig.eval_all? && Homebrew::EnvConfig.no_install_from_api?
      raise UsageError, "`brew search --desc` needs `--eval-all` passed or `HOMEBREW_EVAL_ALL` set!"
    end

    Search.search_descriptions(string_or_regex, args)
  elsif args.pull_request?
    search_pull_requests(query)
  else
    formulae, casks = Search.search_names(string_or_regex, args)
    print_results(formulae, casks, query)
  end

  puts "Use `brew desc` to list packages with a short description." if args.verbose?

  print_regex_help
end