leaves: Use CLI::Parser to parse args

This commit is contained in:
Gautham Goli 2018-11-11 19:13:28 +05:30
parent b0f382c177
commit 2ff0b6471a
No known key found for this signature in database
GPG Key ID: 6A9ABBC284468364

View File

@ -3,11 +3,25 @@
require "formula"
require "tab"
require "cli_parser"
module Homebrew
module_function
def leaves_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`leaves`
Show installed formulae that are not dependencies of another installed formula.
EOS
switch :debug
end
end
def leaves
leaves_args.parse
installed = Formula.installed.sort
deps_of_installed = installed.flat_map do |f|