diff options
author | Max Martin <max@puppetlabs.com> | 2011-04-18 11:44:29 -0700 |
---|---|---|
committer | Max Martin <max@puppetlabs.com> | 2011-04-18 11:44:29 -0700 |
commit | b142973a94ced6c0ff43da882189abe806c18c68 (patch) | |
tree | ebfc9ca02c463ce381cd9c2d2cafc4497e440dfc /lib/puppet/interface/option.rb | |
parent | 977684ee83627194c78c81e30c001f3d9062f6f3 (diff) | |
parent | 13e64fe9d72a0207ff65a35242d855cd3c55dd43 (diff) | |
download | puppet-b142973a94ced6c0ff43da882189abe806c18c68.tar.gz puppet-b142973a94ced6c0ff43da882189abe806c18c68.tar.xz puppet-b142973a94ced6c0ff43da882189abe806c18c68.zip |
Merge branch 'ticket/2.7.x/7131-optional-arguments' into 2.7.x
* ticket/2.7.x/7131-optional-arguments:
(#7131) Remove support for optional arguments to options
Diffstat (limited to 'lib/puppet/interface/option.rb')
-rw-r--r-- | lib/puppet/interface/option.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/puppet/interface/option.rb b/lib/puppet/interface/option.rb index ab18261b9..1971926d8 100644 --- a/lib/puppet/interface/option.rb +++ b/lib/puppet/interface/option.rb @@ -43,8 +43,9 @@ class Puppet::Interface::Option # Is our argument optional? The rules about consistency apply here, also, # just like they do to taking arguments at all. --daniel 2011-03-30 - @optional_argument = @optparse.any? { |o| o.include? "[" } - if @optional_argument and not @optparse.all? { |o| o.include? "[" } then + @optional_argument = @optparse.any? { |o| o=~/[ =]\[/ } + @optional_argument and raise ArgumentError, "Options with optional arguments are not supported" + if @optional_argument and not @optparse.all? { |o| o=~/[ =]\[/ } then raise ArgumentError, "Option #{@name} is inconsistent about the argument being optional" end end |