diff options
| author | Jack Nagel | 2014-08-29 19:38:32 -0500 |
|---|---|---|
| committer | Jack Nagel | 2014-08-29 19:38:32 -0500 |
| commit | 6f10814279880982d314c312c35465391ea096b2 (patch) | |
| tree | 8f571010961fa9f92dcfe6beebdc430309e600dc | |
| parent | 4a7a733e3bfae276533c3c2a6f198e0cec01d460 (diff) | |
| download | homebrew-6f10814279880982d314c312c35465391ea096b2.tar.bz2 | |
Move handling of leading dashes to Options.create
| -rw-r--r-- | Library/Homebrew/options.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/test/test_options.rb | 6 |
2 files changed, 2 insertions, 8 deletions
diff --git a/Library/Homebrew/options.rb b/Library/Homebrew/options.rb index 6978b553b..e43dc3a5a 100644 --- a/Library/Homebrew/options.rb +++ b/Library/Homebrew/options.rb @@ -38,8 +38,6 @@ class Option [name, "-#{name}"] when /^-[a-zA-Z]$/ [name[1..1], name] - when /^--(.+)$/ - [$1, name] else [name, "--#{name}"] end @@ -55,6 +53,8 @@ class Options case e when /^-[^-]+$/ e[1..-1].split(//).each { |o| options << Option.new(o) } + when /^--(.+)$/ + options << Option.new($1) else options << Option.new(e) end diff --git a/Library/Homebrew/test/test_options.rb b/Library/Homebrew/test/test_options.rb index 25049ded5..917ad590c 100644 --- a/Library/Homebrew/test/test_options.rb +++ b/Library/Homebrew/test/test_options.rb @@ -19,12 +19,6 @@ class OptionTests < Homebrew::TestCase refute_eql @option, bar end - def test_strips_leading_dashes - option = Option.new("--foo") - assert_equal "foo", option.name - assert_equal "--foo", option.flag - end - def test_description assert_empty @option.description assert_equal "foo", Option.new("foo", "foo").description |
