--prefix: use CLI::Parser.

This commit is contained in:
Mike McQuaid 2019-01-30 21:29:43 +00:00
parent 515d4c023d
commit b521ba0c7a
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70

View File

@ -1,13 +1,25 @@
#: * `--prefix`:
#: Display Homebrew's install path. *Default:* `/usr/local` on macOS and `/home/linuxbrew/.linuxbrew` on Linux
#:
#: * `--prefix` <formula>:
#: Display the location in the cellar where <formula> is or would be installed.
require "cli_parser"
module Homebrew
module_function
def __prefix_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`--prefix` [<formula>]
Display Homebrew's install path. *Default:* `/usr/local` on macOS and
`/home/linuxbrew/.linuxbrew` on Linux.
If <formula> is provided, display the location in the cellar where <formula>
is or would be installed.
EOS
end
end
def __prefix
__prefix_args.parse
if ARGV.named.empty?
puts HOMEBREW_PREFIX
else