diff --git a/Library/Homebrew/cli/parser.rb b/Library/Homebrew/cli/parser.rb index 2bc86bc4e0..179c4c17a4 100644 --- a/Library/Homebrew/cli/parser.rb +++ b/Library/Homebrew/cli/parser.rb @@ -455,11 +455,13 @@ module Homebrew def check_named_args(args) min_exception = case @min_named_type when :cask - Cask::CaskUnspecifiedError.new + Cask::CaskUnspecifiedError when :formula - FormulaUnspecifiedError.new + FormulaUnspecifiedError + when :formula_or_cask + FormulaOrCaskUnspecifiedError when :keg - KegUnspecifiedError.new + KegUnspecifiedError else MinNamedArgumentsError.new(@min_named_args) end diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index 824e4af6f2..cfbd960e3f 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -143,7 +143,7 @@ module Homebrew end cask_options - min_named 1 + min_named :formula_or_cask end end diff --git a/Library/Homebrew/cmd/reinstall.rb b/Library/Homebrew/cmd/reinstall.rb index c760cfa578..0bb8b28069 100644 --- a/Library/Homebrew/cmd/reinstall.rb +++ b/Library/Homebrew/cmd/reinstall.rb @@ -80,7 +80,7 @@ module Homebrew end cask_options - min_named 1 + min_named :formula_or_cask end end diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb index a18499f691..35913baf0a 100644 --- a/Library/Homebrew/exceptions.rb +++ b/Library/Homebrew/exceptions.rb @@ -27,6 +27,13 @@ class FormulaUnspecifiedError < UsageError end end +# Raised when a command expects a formula or cask and none was specified. +class FormulaOrCaskUnspecifiedError < UsageError + def initialize + super "this command requires a formula or cask argument" + end +end + # Raised when a command expects a keg and none was specified. class KegUnspecifiedError < UsageError def initialize