Refactor MinNamedArgumentsError and MaxNamedArgumentsError.
This commit is contained in:
parent
0732a86a24
commit
2ee30b8067
@ -454,29 +454,18 @@ module Homebrew
|
|||||||
|
|
||||||
class MaxNamedArgumentsError < UsageError
|
class MaxNamedArgumentsError < UsageError
|
||||||
def initialize(maximum)
|
def initialize(maximum)
|
||||||
message = case maximum
|
super case maximum
|
||||||
when 0
|
when 0
|
||||||
"this command does not take named arguments"
|
"This command does not take named arguments."
|
||||||
when 1
|
|
||||||
"this command does not take multiple named arguments"
|
|
||||||
else
|
else
|
||||||
"this command does not take more than #{maximum} named arguments"
|
"This command does not take more than #{maximum} named #{"argument".pluralize(maximum)}"
|
||||||
end
|
end
|
||||||
super message
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class MinNamedArgumentsError < UsageError
|
class MinNamedArgumentsError < UsageError
|
||||||
def initialize(minimum)
|
def initialize(minimum)
|
||||||
message = case minimum
|
super "This command requires at least #{minimum} named #{"argument".pluralize(minimum)}."
|
||||||
when 1
|
|
||||||
"this command requires a named argument"
|
|
||||||
when 2
|
|
||||||
"this command requires multiple named arguments"
|
|
||||||
else
|
|
||||||
"this command requires at least #{minimum} named arguments"
|
|
||||||
end
|
|
||||||
super message
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user