list: Integrate brew list with brew cask list

This commit is contained in:
William Ma 2020-07-08 12:02:42 -04:00
parent d5123743b6
commit 28c0962430

View File

@ -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 <formula> 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