cat: raise unless object is formulae

Until a point in time when the Cask/Homebrew codebases are harmonised a little
more it probably makes sense to refuse to `cat` Casks. Right now the Homebrew
codebase is only minimally aware of what a Cask is.

Fixes Homebrew/homebrew#45300.
Fixes Homebrew/homebrew#44630.

Closes Homebrew/homebrew#45302.

Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>
This commit is contained in:
Dominyk Tiller 2015-10-25 01:13:16 +01:00
parent db66177d6c
commit 82f5660752

View File

@ -3,9 +3,11 @@ module Homebrew
# do not "fix" this to support multiple arguments, the output would be
# unparsable, if the user wants to cat multiple formula they can call
# brew cat multiple times.
formulae = ARGV.formulae
raise FormulaUnspecifiedError if formulae.empty?
raise "`brew cat` doesn't support multiple arguments" if formulae.size > 1
raise FormulaUnspecifiedError if ARGV.named.empty?
cd HOMEBREW_REPOSITORY
exec "cat", ARGV.formulae.first.path, *ARGV.options_only
exec "cat", formulae.first.path, *ARGV.options_only
end
end