From 28c0962430bb33806bb4870ba394192e606d26f5 Mon Sep 17 00:00:00 2001 From: William Ma Date: Wed, 8 Jul 2020 12:02:42 -0400 Subject: [PATCH 1/3] list: Integrate brew list with brew cask list --- Library/Homebrew/cmd/list.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Library/Homebrew/cmd/list.rb b/Library/Homebrew/cmd/list.rb index d3922efadf..30809f0948 100644 --- a/Library/Homebrew/cmd/list.rb +++ b/Library/Homebrew/cmd/list.rb @@ -3,6 +3,7 @@ require "metafiles" require "formula" require "cli/parser" +require "cask/cmd" module Homebrew module_function @@ -31,6 +32,8 @@ module Homebrew switch "--pinned", description: "Show the versions of pinned formulae, or only the specified (pinned) "\ "formulae if are provided. See also `pin`, `unpin`." + switch "--casks", + description: "List casks" # passed through to ls switch "-1", description: "Force output to be one entry per line. " \ @@ -44,12 +47,15 @@ module Homebrew description: "Sort by time modified, listing most recently modified first." switch :verbose switch :debug + conflicts "--casks", "--unbrewed", "--multiple", "--pinned", "-l", "-r", "-t" end end def list list_args.parse + return list_casks if args.casks? + return list_unbrewed if args.unbrewed? # Unbrewed uses the PREFIX, which will exist @@ -150,6 +156,14 @@ module Homebrew end end end + + def list_casks + cask_list = Cask::Cmd::List.new args.named + cask_list.one = ARGV.include? "-1" + cask_list.versions = args.versions? + cask_list.full_name = args.full_name? + cask_list.run + end end class PrettyListing From 8f3d230995ed76dcd7c8dc8abd9bf0a27c761bae Mon Sep 17 00:00:00 2001 From: William Ma Date: Wed, 8 Jul 2020 20:39:54 -0400 Subject: [PATCH 2/3] list: Remove extraneous 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 30809f0948..758c98b2c3 100644 --- a/Library/Homebrew/cmd/list.rb +++ b/Library/Homebrew/cmd/list.rb @@ -47,7 +47,7 @@ module Homebrew description: "Sort by time modified, listing most recently modified first." switch :verbose switch :debug - conflicts "--casks", "--unbrewed", "--multiple", "--pinned", "-l", "-r", "-t" + ["--unbrewed", "--multiple", "--pinned", "-l", "-r", "-t"].each { |flag| conflicts "--casks", flag } end end From 62a5614850ffbe839a1d39cbb6850b635b7a2b00 Mon Sep 17 00:00:00 2001 From: William Ma Date: Thu, 9 Jul 2020 11:21:22 -0400 Subject: [PATCH 3/3] list: Update documentation --- Library/Homebrew/cmd/list.rb | 6 +++--- docs/Manpage.md | 2 ++ manpages/brew.1 | 4 ++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/cmd/list.rb b/Library/Homebrew/cmd/list.rb index 758c98b2c3..6dda14d46a 100644 --- a/Library/Homebrew/cmd/list.rb +++ b/Library/Homebrew/cmd/list.rb @@ -32,7 +32,7 @@ module Homebrew switch "--pinned", description: "Show the versions of pinned formulae, or only the specified (pinned) "\ "formulae if are provided. See also `pin`, `unpin`." - switch "--casks", + switch "--cask", description: "List casks" # passed through to ls switch "-1", @@ -47,14 +47,14 @@ module Homebrew description: "Sort by time modified, listing most recently modified first." switch :verbose switch :debug - ["--unbrewed", "--multiple", "--pinned", "-l", "-r", "-t"].each { |flag| conflicts "--casks", flag } + ["--unbrewed", "--multiple", "--pinned", "-l", "-r", "-t"].each { |flag| conflicts "--cask", flag } end end def list list_args.parse - return list_casks if args.casks? + return list_casks if args.cask? return list_unbrewed if args.unbrewed? diff --git a/docs/Manpage.md b/docs/Manpage.md index 2aa5bc9ed3..cab07ef0ab 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -290,6 +290,8 @@ If *`formula`* is provided, summarise the paths within its current keg. Only show formulae with multiple versions installed. * `--pinned`: Show the versions of pinned formulae, or only the specified (pinned) formulae if *`formula`* are provided. See also `pin`, `unpin`. +* `--cask`: + List casks * `-1`: Force output to be one entry per line. This is the default when output is not to a terminal. * `-l`: diff --git a/manpages/brew.1 b/manpages/brew.1 index 525eeddfd8..5fd7811650 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -393,6 +393,10 @@ Only show formulae with multiple versions installed\. Show the versions of pinned formulae, or only the specified (pinned) formulae if \fIformula\fR are provided\. See also \fBpin\fR, \fBunpin\fR\. . .TP +\fB\-\-cask\fR +List casks +. +.TP \fB\-1\fR Force output to be one entry per line\. This is the default when output is not to a terminal\. .