From 3ccb1f632865704979fd69769bcd748bb197ded2 Mon Sep 17 00:00:00 2001 From: hyuraku <32809703+hyuraku@users.noreply.github.com> Date: Sun, 25 Jul 2021 20:10:35 +0900 Subject: [PATCH] search by desc with formula-cask option --- Library/Homebrew/cmd/search.rb | 2 +- Library/Homebrew/extend/os/mac/search.rb | 4 +++- Library/Homebrew/search.rb | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/cmd/search.rb b/Library/Homebrew/cmd/search.rb index 6e4e17345a..76b4b0af8b 100644 --- a/Library/Homebrew/cmd/search.rb +++ b/Library/Homebrew/cmd/search.rb @@ -78,7 +78,7 @@ module Homebrew string_or_regex = query_regexp(query) if args.desc? - search_descriptions(string_or_regex) + search_descriptions(string_or_regex, args) elsif args.pull_request? only = if args.open? && !args.closed? "open" diff --git a/Library/Homebrew/extend/os/mac/search.rb b/Library/Homebrew/extend/os/mac/search.rb index f25e05c43d..bd188a2425 100644 --- a/Library/Homebrew/extend/os/mac/search.rb +++ b/Library/Homebrew/extend/os/mac/search.rb @@ -7,11 +7,13 @@ require "cask/cask_loader" module Homebrew module Search module Extension - def search_descriptions(string_or_regex) + def search_descriptions(string_or_regex, args) super puts + return if args.formula? + ohai "Casks" Cask::Cask.to_a.extend(Searchable) .search(string_or_regex, &:name) diff --git a/Library/Homebrew/search.rb b/Library/Homebrew/search.rb index 45906d0150..ba277b3b34 100644 --- a/Library/Homebrew/search.rb +++ b/Library/Homebrew/search.rb @@ -19,7 +19,9 @@ module Homebrew raise "#{query} is not a valid regex." end - def search_descriptions(string_or_regex) + def search_descriptions(string_or_regex, args) + return if args.cask? + ohai "Formulae" CacheStoreDatabase.use(:descriptions) do |db| cache_store = DescriptionCacheStore.new(db)