diff options
| author | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-04 11:35:46 -0700 |
|---|---|---|
| committer | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-04 13:32:04 -0700 |
| commit | 0c74495529bd697cdc42986882fc3efb4cdc9903 (patch) | |
| tree | c0489dfd1b5d0a2cdf516d51f34a87e18c150e94 /lib/puppet/application | |
| parent | cec3b6e2627ea2340e46c2e498f4d41522140094 (diff) | |
| download | puppet-0c74495529bd697cdc42986882fc3efb4cdc9903.tar.gz puppet-0c74495529bd697cdc42986882fc3efb4cdc9903.tar.xz puppet-0c74495529bd697cdc42986882fc3efb4cdc9903.zip | |
(#6749) Handle options with inline arguments.
We didn't correctly handle '--foo=bar' as having supplied an argument during
the pre-parse phase. Now we have a test for it, and a fix in the code.
Reviewed-By: Nick Lewis <nick@puppetlabs.com>
Diffstat (limited to 'lib/puppet/application')
| -rw-r--r-- | lib/puppet/application/string_base.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/puppet/application/string_base.rb b/lib/puppet/application/string_base.rb index 8284a3185..06e5789be 100644 --- a/lib/puppet/application/string_base.rb +++ b/lib/puppet/application/string_base.rb @@ -71,7 +71,11 @@ class Puppet::Application::StringBase < Puppet::Application option = @string.options.find { |a| item =~ /^-+#{a}\b/ } if option then option = @string.get_option(option) - if option.takes_argument? then + # If we have an inline argument, just carry on. We don't need to + # care about optional vs mandatory in that case because we do a real + # parse later, and that will totally take care of raising the error + # when we get there. --daniel 2011-04-04 + if option.takes_argument? and !item.index('=') then index += 1 unless (option.optional_argument? and command_line.args[index + 1] =~ /^-/) end |
