summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Bode <dan@puppetlabs.com>2011-07-15 14:51:25 -0700
committerDan Bode <dan@puppetlabs.com>2011-07-15 14:51:25 -0700
commit756314da4e48b8a138a1e38f1ae276d6721ef410 (patch)
treeaa0675aedd35be1940f010e0ba33c5072a45ba2c
parent833edd0abaa13cd71da0d200b593f3f63bc4b7b9 (diff)
parentb82f29c61aa84a12fc208487e4b049cb24702261 (diff)
downloadpuppet-756314da4e48b8a138a1e38f1ae276d6721ef410.tar.gz
puppet-756314da4e48b8a138a1e38f1ae276d6721ef410.tar.xz
puppet-756314da4e48b8a138a1e38f1ae276d6721ef410.zip
Merge branch 'issue/2.7.x/7699' into 2.7.x
-rw-r--r--lib/puppet/interface/action.rb3
-rw-r--r--lib/puppet/interface/option_manager.rb3
-rwxr-xr-xspec/shared_behaviours/things_that_declare_options.rb2
-rwxr-xr-xspec/unit/interface/action_spec.rb10
-rwxr-xr-xspec/unit/interface_spec.rb8
5 files changed, 23 insertions, 3 deletions
diff --git a/lib/puppet/interface/action.rb b/lib/puppet/interface/action.rb
index 185302b07..fe77a9658 100644
--- a/lib/puppet/interface/action.rb
+++ b/lib/puppet/interface/action.rb
@@ -227,8 +227,9 @@ WRAPPER
end
end
+ @options << option.name
+
option.aliases.each do |name|
- @options << name
@options_hash[name] = option
end
diff --git a/lib/puppet/interface/option_manager.rb b/lib/puppet/interface/option_manager.rb
index 326a91d92..a1f300e8e 100644
--- a/lib/puppet/interface/option_manager.rb
+++ b/lib/puppet/interface/option_manager.rb
@@ -26,8 +26,9 @@ module Puppet::Interface::OptionManager
end
end
+ @options << option.name
+
option.aliases.each do |name|
- @options << name
@options_hash[name] = option
end
diff --git a/spec/shared_behaviours/things_that_declare_options.rb b/spec/shared_behaviours/things_that_declare_options.rb
index ebf1b2071..19bba66c1 100755
--- a/spec/shared_behaviours/things_that_declare_options.rb
+++ b/spec/shared_behaviours/things_that_declare_options.rb
@@ -43,7 +43,7 @@ shared_examples_for "things that declare options" do
option "-f"
option "--baz"
end
- thing.options.should == [:foo, :bar, :b, :q, :quux, :f, :baz]
+ thing.options.should == [:foo, :bar, :quux, :f, :baz]
end
it "should detect conflicts in long options" do
diff --git a/spec/unit/interface/action_spec.rb b/spec/unit/interface/action_spec.rb
index cf8d61d51..23216e7b4 100755
--- a/spec/unit/interface/action_spec.rb
+++ b/spec/unit/interface/action_spec.rb
@@ -171,6 +171,16 @@ describe Puppet::Interface::Action do
face.get_action(:foo).options.should =~ [:bar]
end
+ it "should only list options and not aliases" do
+ face = Puppet::Interface.new(:action_level_options, '0.0.1') do
+ action :foo do
+ when_invoked do |options| true end
+ option "--bar", "-b", "--foo-bar"
+ end
+ end
+ face.get_action(:foo).options.should =~ [:bar]
+ end
+
describe "with both face and action options" do
let :face do
Puppet::Interface.new(:action_level_options, '0.0.1') do
diff --git a/spec/unit/interface_spec.rb b/spec/unit/interface_spec.rb
index 8bbbcc857..4cb1f8743 100755
--- a/spec/unit/interface_spec.rb
+++ b/spec/unit/interface_spec.rb
@@ -174,6 +174,14 @@ describe Puppet::Interface do
face.get_action(:foo).options.should =~ [:quux]
face.get_action(:bar).options.should =~ [:quux]
end
+
+ it "should only list options and not aliases" do
+ face = subject.new(:face_options, '0.0.1') do
+ option "--bar", "-b", "--foo-bar"
+ end
+ face.options.should =~ [:bar]
+ end
+
end
describe "with inherited options" do