From 6885f588d024839f1f49df0859a682e0e9963e04 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Fri, 29 Aug 2014 19:38:32 -0500 Subject: [PATCH] Move handling of leading dashes to Options.create --- Library/Homebrew/options.rb | 4 ++-- 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 6978b553bc..e43dc3a5a6 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 25049ded53..917ad590c7 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