mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Formula: include bad value in invalid-option error message
Makes identifying which line in a formula has the bad use of 'option' easier. Closes #120. Signed-off-by: Andrew Janke <andrew@apjanke.net>
This commit is contained in:
parent
a3b70d38a7
commit
094f6f47dd
@ -122,9 +122,12 @@ class SoftwareSpec
|
||||
puts "Symbols are reserved for future use, please pass a string instead"
|
||||
name = name.to_s
|
||||
end
|
||||
unless String === name
|
||||
raise ArgumentError, "option name must be string or symbol; got a #{name.class}: #{name}"
|
||||
end
|
||||
raise ArgumentError, "option name is required" if name.empty?
|
||||
raise ArgumentError, "option name must be longer than one character" unless name.length > 1
|
||||
raise ArgumentError, "option name must not start with dashes" if name.start_with?("-")
|
||||
raise ArgumentError, "option name must be longer than one character: #{name}" unless name.length > 1
|
||||
raise ArgumentError, "option name must not start with dashes: #{name}" if name.start_with?("-")
|
||||
Option.new(name, description)
|
||||
end
|
||||
options << opt
|
||||
|
Loading…
x
Reference in New Issue
Block a user