cleanup: Use CLI::Parser to parse args
This commit is contained in:
parent
dbc43a7a2b
commit
cffa796634
@ -18,12 +18,32 @@ require "cli_parser"
|
|||||||
module Homebrew
|
module Homebrew
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
def cleanup
|
def cleanup_args
|
||||||
CLI::Parser.parse do
|
Homebrew::CLI::Parser.new do
|
||||||
switch "-n", "--dry-run"
|
usage_banner <<~EOS
|
||||||
switch "-s"
|
`cleanup` [<options>] [<formulae>|<casks>]
|
||||||
flag "--prune="
|
|
||||||
|
|
||||||
|
Remove stale lock files and outdated downloads for formulae and casks,
|
||||||
|
and remove old versions of installed formulae. If arguments are specified,
|
||||||
|
only do this for the specified formulae and casks.
|
||||||
|
EOS
|
||||||
|
|
||||||
|
flag "--prune=",
|
||||||
|
description: "Remove all cache files older than specified <days>."
|
||||||
|
switch "-n", "--dry-run",
|
||||||
|
description: "Show what would be removed, but do not actually remove anything."
|
||||||
|
switch "-s",
|
||||||
|
description: "Scrub the cache, including downloads for even the latest versions. "\
|
||||||
|
"Note downloads for any installed formula or cask will still not be deleted. "\
|
||||||
|
"If you want to delete those too: `rm -rf \"$(brew --cache)\"`"
|
||||||
|
switch :verbose
|
||||||
|
switch :debug
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def cleanup
|
||||||
|
cleanup_args.parse
|
||||||
|
|
||||||
cleanup = Cleanup.new(*args.remaining, dry_run: args.dry_run?, scrub: args.s?, days: args.prune&.to_i)
|
cleanup = Cleanup.new(*args.remaining, dry_run: args.dry_run?, scrub: args.s?, days: args.prune&.to_i)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user