Module: Homebrew::Search::Extension Private

Defined in:
Library/Homebrew/extend/os/mac/search.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Instance Method Details

#search_casks(string_or_regex) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'Library/Homebrew/extend/os/mac/search.rb', line 23

def search_casks(string_or_regex)
  if string_or_regex.is_a?(String) && string_or_regex.match?(HOMEBREW_TAP_CASK_REGEX)
    return begin
      [Cask::CaskLoader.load(string_or_regex).token]
    rescue Cask::CaskUnavailableError
      []
    end
  end

  results = Cask::Cask.search(string_or_regex, &:token).sort_by(&:token)

  results.map do |cask|
    if cask.installed?
      pretty_installed(cask.token)
    else
      cask.token
    end
  end
end

#search_descriptions(string_or_regex) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


10
11
12
13
14
15
16
17
18
19
20
21
# File 'Library/Homebrew/extend/os/mac/search.rb', line 10

def search_descriptions(string_or_regex)
  super

  puts

  ohai "Casks"
  Cask::Cask.to_a.extend(Searchable)
            .search(string_or_regex, &:name)
            .each do |cask|
    puts "#{Tty.bold}#{cask.token}:#{Tty.reset} #{cask.name.join(", ")}"
  end
end