More granular 'brew search' query == simpler code
This commit is contained in:
parent
296d48ba7a
commit
d74721acc7
@ -110,10 +110,10 @@ module Homebrew
|
|||||||
$stderr.puts Formatter.headline("Searching taps on GitHub...", color: :blue)
|
$stderr.puts Formatter.headline("Searching taps on GitHub...", color: :blue)
|
||||||
end
|
end
|
||||||
|
|
||||||
valid_dirnames = ["Formula", "HomebrewFormula", "Casks", "."].freeze
|
|
||||||
matches = begin
|
matches = begin
|
||||||
GitHub.search_code(
|
GitHub.search_code(
|
||||||
user: ["Homebrew", "caskroom"],
|
user: ["Homebrew", "caskroom"],
|
||||||
|
path: ["Formula", "HomebrewFormula", "Casks", "."],
|
||||||
filename: query,
|
filename: query,
|
||||||
extension: "rb",
|
extension: "rb",
|
||||||
)
|
)
|
||||||
@ -122,11 +122,10 @@ module Homebrew
|
|||||||
[]
|
[]
|
||||||
end
|
end
|
||||||
matches.map do |match|
|
matches.map do |match|
|
||||||
dirname, filename = File.split(match["path"])
|
filename = File.basename(match["path"], ".rb")
|
||||||
next unless valid_dirnames.include?(dirname)
|
|
||||||
tap = Tap.fetch(match["repository"]["full_name"])
|
tap = Tap.fetch(match["repository"]["full_name"])
|
||||||
next if tap.installed? && match["repository"]["owner"]["login"] != "caskroom"
|
next if tap.installed? && match["repository"]["owner"]["login"] != "caskroom"
|
||||||
"#{tap.name}/#{File.basename(filename, ".rb")}"
|
"#{tap.name}/#{filename}"
|
||||||
end.compact
|
end.compact
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user