From e966808ac66258ed7416b5211b0bf242b31c2d2f Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Fri, 26 Mar 2021 18:54:53 +0000 Subject: [PATCH 1/2] cmd/list: always use ls when no named args are passed This has the added benefit of making the indentation in the output of `brew list` uniform between formulae and casks. Follow-up to #10899. See, in particular, https://github.com/Homebrew/brew/pull/10899#discussion_r598659321 --- Library/Homebrew/cmd/list.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Library/Homebrew/cmd/list.rb b/Library/Homebrew/cmd/list.rb index 67e5737a03..a66a8a2aa1 100644 --- a/Library/Homebrew/cmd/list.rb +++ b/Library/Homebrew/cmd/list.rb @@ -45,14 +45,14 @@ module Homebrew description: "Force output to be one entry per line. " \ "This is the default when output is not to a terminal." switch "-l", - depends_on: "--formula", - description: "List formulae in long format." + description: "List formulae and/or casks in long format. " \ + "Has no effect when a formula or cask name is passed as an argument." switch "-r", - depends_on: "--formula", - description: "Reverse the order of the formulae sort to list the oldest entries first." + description: "Reverse the order of the formulae and/or casks sort to list the oldest entries first. " \ + "Has no effect when a formula or cask name is passed as an argument." switch "-t", - depends_on: "--formula", - description: "Sort formulae by time modified, listing most recently modified first." + description: "Sort formulae and/or casks by time modified, listing most recently modified first. " \ + "Has no effect when a formula or cask name is passed as an argument." conflicts "--formula", "--cask" conflicts "--full-name", "--versions" @@ -126,7 +126,7 @@ module Homebrew puts ohai "Casks" end - list_casks(args: args) + safe_system "ls", *ls_args, Cask::Caskroom.path end elsif args.verbose? || !$stdout.tty? system_command! "find", args: args.named.to_kegs.map(&:to_s) + %w[-not -type d -print], print_stdout: true From a3a6af9d99141160dad21ff8f04e9fdcacd274f4 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Fri, 26 Mar 2021 19:18:48 +0000 Subject: [PATCH 2/2] cmd/list: remove cask and ls flag conflicts --- Library/Homebrew/cmd/list.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/cmd/list.rb b/Library/Homebrew/cmd/list.rb index a66a8a2aa1..4132d9bf16 100644 --- a/Library/Homebrew/cmd/list.rb +++ b/Library/Homebrew/cmd/list.rb @@ -57,6 +57,7 @@ module Homebrew conflicts "--formula", "--cask" conflicts "--full-name", "--versions" conflicts "--pinned", "--multiple" + conflicts "--pinned", "--cask" conflicts "--cask", "--multiple" ["--formula", "--cask", "--full-name", "--versions", "--pinned"].each do |flag| conflicts "--unbrewed", flag @@ -68,7 +69,6 @@ module Homebrew end ["--pinned", "-l", "-r", "-t"].each do |flag| conflicts "--full-name", flag - conflicts "--cask", flag end named_args [:installed_formula, :installed_cask]