Merge pull request #5307 from GauthamGoli/list-args

list: Add help text
This commit is contained in:
Mike McQuaid 2018-11-24 11:46:04 +00:00 committed by GitHub
commit e0c4fca756
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,20 +25,46 @@ require "cli_parser"
module Homebrew module Homebrew
module_function module_function
def list def list_args
Homebrew::CLI::Parser.parse do Homebrew::CLI::Parser.new do
switch "--unbrewed" usage_banner <<~EOS
switch "--pinned" `list`, `ls` [<options>] [`-1`] [`-l`] [`-t`] [`-r`]
switch "--versions"
switch "--full-name" List all installed formulae.
switch "--multiple", depends_on: "--versions" EOS
switch :verbose switch "--full-name",
description: "Print formulae with fully-qualified names. If `--full-name` is not "\
"passed, other options (i.e. `-1`, `-l`, `-t` and `-r`) are passed to `ls` "\
"which produces the actual output."
switch "--unbrewed",
description: "List all files in the Homebrew prefix not installed by Homebrew."
switch "--versions",
description: "Show the version number for installed formulae, or only the specified "\
"formulae if <formulae> are given."
switch "--multiple",
depends_on: "--versions",
description: "Only show formulae with multiple versions installed."
switch "--pinned",
description: "Show the versions of pinned formulae, or only the specified (pinned) "\
"formulae if <formulae> are given. See also `pin`, `unpin`."
# passed through to ls # passed through to ls
switch "-1" switch "-1",
switch "-l" description: "Force output to be one entry per line. " \
switch "-t" "This is the default when output is not to a terminal."
switch "-r" switch "-l",
description: "List in long format. If the output is to a terminal, "\
"a total sum for all the file sizes is output on a line before the long listing."
switch "-r",
description: "Reverse the order of the sort to get the oldest entries first."
switch "-t",
description: "Sort by time modified (most recently modified first)."
switch :verbose
switch :debug
end end
end
def list
list_args.parse
# Use of exec means we don't explicitly exit # Use of exec means we don't explicitly exit
list_unbrewed if args.unbrewed? list_unbrewed if args.unbrewed?