aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorJack Nagel2014-08-29 19:38:32 -0500
committerJack Nagel2014-08-29 19:38:32 -0500
commit6885f588d024839f1f49df0859a682e0e9963e04 (patch)
tree14ea87085924554d62f5e0deca9e36183c134b3a /Library/Homebrew
parent7adbb1ccb9f060c4f6b47644b34369c56b9d28f6 (diff)
downloadbrew-6885f588d024839f1f49df0859a682e0e9963e04.tar.bz2
Move handling of leading dashes to Options.create
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/options.rb4
-rw-r--r--Library/Homebrew/test/test_options.rb6
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