Merge pull request #12003 from hyuraku/brew-list-shows-cask-without-option

brew list shows cask without option
This commit is contained in:
Rylan Polster 2021-09-11 19:42:59 -04:00 committed by GitHub
commit 8db3289f15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View File

@ -77,7 +77,7 @@ module Homebrew
def to_formulae_to_casks(only: parent&.only_formula_or_cask, method: nil) def to_formulae_to_casks(only: parent&.only_formula_or_cask, method: nil)
@to_formulae_to_casks ||= {} @to_formulae_to_casks ||= {}
@to_formulae_to_casks[[method, only]] = to_formulae_and_casks(only: only, method: method) @to_formulae_to_casks[[method, only]] = to_formulae_and_casks(only: only, method: method)
.partition { |o| o.is_a?(Formula) } .partition { |o| o.is_a?(Formula) || o.is_a?(Keg) }
.map(&:freeze).freeze .map(&:freeze).freeze
end end

View File

@ -104,7 +104,7 @@ module Homebrew
puts full_cask_names if full_cask_names.present? puts full_cask_names if full_cask_names.present?
end end
elsif args.cask? elsif args.cask?
list_casks(args: args) list_casks(args.named.to_casks, args: args)
elsif args.pinned? || args.versions? elsif args.pinned? || args.versions?
filtered_list args: args filtered_list args: args
elsif args.no_named? elsif args.no_named?
@ -132,7 +132,10 @@ module Homebrew
system_command! "find", args: args.named.to_default_kegs.map(&:to_s) + %w[-not -type d -print], system_command! "find", args: args.named.to_default_kegs.map(&:to_s) + %w[-not -type d -print],
print_stdout: true print_stdout: true
else else
args.named.to_default_kegs.each { |keg| PrettyListing.new keg } kegs, casks = args.named.to_formulae_to_casks(method: :default_kegs)
kegs.each { |keg| PrettyListing.new keg } if kegs.present?
list_casks(casks, args: args) if casks.present?
end end
end end
@ -165,9 +168,9 @@ module Homebrew
end end
end end
def list_casks(args:) def list_casks(casks, args:)
Cask::Cmd::List.list_casks( Cask::Cmd::List.list_casks(
*args.named.to_casks, *casks,
one: args.public_send(:"1?"), one: args.public_send(:"1?"),
full_name: args.full_name?, full_name: args.full_name?,
versions: args.versions?, versions: args.versions?,