diff --git a/Library/Homebrew/cmd/leaves.rb b/Library/Homebrew/cmd/leaves.rb index 76fb8784ca..72241fb95d 100644 --- a/Library/Homebrew/cmd/leaves.rb +++ b/Library/Homebrew/cmd/leaves.rb @@ -11,7 +11,7 @@ module Homebrew def leaves_args Homebrew::CLI::Parser.new do description <<~EOS - List installed formulae that are not dependencies of another installed formula. + List installed formulae that are not dependencies of another installed formula and cask. EOS switch "-r", "--installed-on-request", description: "Only list leaves that were manually installed." @@ -36,7 +36,10 @@ module Homebrew args = leaves_args.parse leaves_list = Formula.installed - Formula.installed.flat_map(&:runtime_formula_dependencies) - + casks_runtime_dependencies = Cask::Caskroom.casks.flat_map do |cask| + CaskDependent.new(cask).runtime_dependencies.map(&:to_formula) + end + leaves_list -= casks_runtime_dependencies leaves_list.select!(&method(:installed_on_request?)) if args.installed_on_request? leaves_list.select!(&method(:installed_as_dependency?)) if args.installed_as_dependency?