--cache: use CLI::Parser.
This commit is contained in:
parent
0fff6e0c09
commit
8fca70e76b
@ -1,15 +1,29 @@
|
||||
#: * `--cache`:
|
||||
#: Display Homebrew's download cache. See also `HOMEBREW_CACHE`.
|
||||
#:
|
||||
#: * `--cache` [`--build-from-source`|`-s`] [`--force-bottle`] <formula>:
|
||||
#: Display the file or directory used to cache <formula>.
|
||||
|
||||
require "fetch"
|
||||
require "cli_parser"
|
||||
|
||||
module Homebrew
|
||||
module_function
|
||||
|
||||
def __cache_args
|
||||
Homebrew::CLI::Parser.new do
|
||||
usage_banner <<~EOS
|
||||
`--cache` [<options>] [<formula>]
|
||||
|
||||
Display Homebrew's download cache. See also `HOMEBREW_CACHE`.
|
||||
|
||||
If <formula> is provided, display the file or directory used to cache <formula>.
|
||||
EOS
|
||||
switch "-s", "--build-from-source",
|
||||
description: "Show the cache file used when building from source."
|
||||
switch "--force-bottle",
|
||||
description: "Show the cache file used when pouring a bottle."
|
||||
conflicts "--build-from-source", "--force-bottle"
|
||||
end
|
||||
end
|
||||
|
||||
def __cache
|
||||
__cache_args.parse
|
||||
|
||||
if ARGV.named.empty?
|
||||
puts HOMEBREW_CACHE
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user