From 82f5660752849771ad2164545ee33c8a78c2a339 Mon Sep 17 00:00:00 2001 From: Dominyk Tiller Date: Sun, 25 Oct 2015 01:13:16 +0100 Subject: [PATCH] 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 --- Library/Homebrew/cmd/cat.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/cmd/cat.rb b/Library/Homebrew/cmd/cat.rb index f42fbc0377..b42e54a57a 100644 --- a/Library/Homebrew/cmd/cat.rb +++ b/Library/Homebrew/cmd/cat.rb @@ -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