I would really appreciate if someone could have a look at this patch. It could potentially cause other things to break if they are expecting the options method of face or action to return an element per alias. I reviewed the code and this did not appear to be the case (all of the tests also passed after this patch)
If anything else is expecting a list of all of the face aliases, it should probably use @options_hash.keys On Wed, Jul 6, 2011 at 10:04 PM, Dan Bode <d...@puppetlabs.com> wrote: > puppet help was reprinting every option once > for every alias that is had. > > This fix involves only storing the option.name > in the @options instance var for both face and > actions options. The @options_hash still > maintains the list of options and aliases as its > keys. > > Signed-off-by: Dan Bode <d...@puppetlabs.com> > --- > Local-branch: issue/master/7699 > lib/puppet/interface/action.rb | 3 ++- > lib/puppet/interface/option_manager.rb | 3 ++- > spec/unit/interface/action_spec.rb | 9 +++++++++ > spec/unit/interface_spec.rb | 8 ++++++++ > 4 files changed, 21 insertions(+), 2 deletions(-) > > diff --git a/lib/puppet/interface/action.rb > b/lib/puppet/interface/action.rb > index 185302b..fe77a96 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 326a91d..a1f300e 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/unit/interface/action_spec.rb > b/spec/unit/interface/action_spec.rb > index cf8d61d..3e1bd0d 100755 > --- a/spec/unit/interface/action_spec.rb > +++ b/spec/unit/interface/action_spec.rb > @@ -171,6 +171,15 @@ 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 > + 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 8bbbcc8..4cb1f87 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 > -- > 1.6.5.1 > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Developers" group. > To post to this group, send email to puppet-dev@googlegroups.com. > To unsubscribe from this group, send email to > puppet-dev+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-dev?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to puppet-dev@googlegroups.com. To unsubscribe from this group, send email to puppet-dev+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.