list: Use CLI::Parser to parse args
This commit is contained in:
parent
b0f382c177
commit
2121094f51
@ -25,20 +25,44 @@ 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: "Option passed to `ls`"
|
||||||
switch "-t"
|
switch "-l",
|
||||||
switch "-r"
|
description: "Option passed to `ls`"
|
||||||
|
switch "-t",
|
||||||
|
description: "Option passed to `ls`"
|
||||||
|
switch "-r",
|
||||||
|
description: "Option passed to `ls`"
|
||||||
|
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?
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user