From 8fca70e76bdd643e246c103057c77c94f79fed8f Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 30 Jan 2019 21:29:21 +0000 Subject: [PATCH] --cache: use CLI::Parser. --- Library/Homebrew/cmd/--cache.rb | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/Library/Homebrew/cmd/--cache.rb b/Library/Homebrew/cmd/--cache.rb index 9298bdb455..812a093319 100644 --- a/Library/Homebrew/cmd/--cache.rb +++ b/Library/Homebrew/cmd/--cache.rb @@ -1,15 +1,29 @@ -#: * `--cache`: -#: Display Homebrew's download cache. See also `HOMEBREW_CACHE`. -#: -#: * `--cache` [`--build-from-source`|`-s`] [`--force-bottle`] : -#: Display the file or directory used to cache . - require "fetch" +require "cli_parser" module Homebrew module_function + def __cache_args + Homebrew::CLI::Parser.new do + usage_banner <<~EOS + `--cache` [] [] + + Display Homebrew's download cache. See also `HOMEBREW_CACHE`. + + If is provided, display the file or directory used to cache . + 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