diff options
| author | Jack Nagel | 2013-01-30 11:04:54 -0600 | 
|---|---|---|
| committer | Jack Nagel | 2013-01-30 11:09:33 -0600 | 
| commit | 7bec7abecd79ea515fe9a8995cc07d41a5050958 (patch) | |
| tree | 966e9b903043ccf58fb602242a0807f00013759a /Library/Homebrew/options.rb | |
| parent | bfc722e552e0f62dff7d9e00c3b7962a5c6497ab (diff) | |
| download | homebrew-7bec7abecd79ea515fe9a8995cc07d41a5050958.tar.bz2 | |
Fix passing multiple switches as a single word to the build
Fixes #17434.
Diffstat (limited to 'Library/Homebrew/options.rb')
| -rw-r--r-- | Library/Homebrew/options.rb | 16 | 
1 files changed, 14 insertions, 2 deletions
| diff --git a/Library/Homebrew/options.rb b/Library/Homebrew/options.rb index e10d9483e..d8783a9d6 100644 --- a/Library/Homebrew/options.rb +++ b/Library/Homebrew/options.rb @@ -1,3 +1,5 @@ +require 'set' +  class Option    include Comparable @@ -33,6 +35,8 @@ class Option    def split_name(name)      case name +    when /^[a-zA-Z]$/ +      [name, "-#{name}"]      when /^-[a-zA-Z]$/        [name[1..1], name]      when /^--(.+)$/ @@ -101,8 +105,16 @@ class Options      case arg      when self then arg      when Option then new << arg -    when Array then new(arg.map { |a| Option.new(a.to_s) }) -    else raise TypeError, "Cannot convert #{arg.inspect} to Options" +    when Array +      opts = arg.map do |arg| +        case arg +        when /^-[^-]+$/ then arg[1..-1].split(//) +        else arg +        end +      end.flatten +      new(opts.map { |o| Option.new(o) }) +    else +      raise TypeError, "Cannot convert #{arg.inspect} to Options"      end    end  end | 
