diff options
author | Tom Duffield <tom@chef.io> | 2016-10-25 15:31:18 -0500 |
---|---|---|
committer | Tom Duffield <tom@chef.io> | 2016-10-28 14:20:49 -0500 |
commit | daa20d6b7e6afb066760b7e7c59f1d9f2b4a409b (patch) | |
tree | 4e3d4534290dcf3786c518daa5f1b55aa7e012be | |
parent | aa9bbabde662a58c581ed4d87707eac5534bc292 (diff) | |
download | chef-daa20d6b7e6afb066760b7e7c59f1d9f2b4a409b.tar.gz |
Make includers of MultiAttributeReturnOption consistent
Make all the Knife subcommands that include
`Chef::Knife::Core::AttributeReturnOption`
consistent in how they handle attributes.
Signed-off-by: Tom Duffield <tom@chef.io>
-rw-r--r-- | lib/chef/knife/core/generic_presenter.rb | 8 | ||||
-rw-r--r-- | lib/chef/knife/node_show.rb | 5 | ||||
-rw-r--r-- | lib/chef/knife/osc_user_show.rb | 1 |
3 files changed, 5 insertions, 9 deletions
diff --git a/lib/chef/knife/core/generic_presenter.rb b/lib/chef/knife/core/generic_presenter.rb index 3f5c0712d0..a963a24f12 100644 --- a/lib/chef/knife/core/generic_presenter.rb +++ b/lib/chef/knife/core/generic_presenter.rb @@ -28,12 +28,14 @@ class Chef # :nodoc: def self.included(includer) includer.class_eval do - @attrs_to_show = [] option :attribute, :short => "-a ATTR1 [-a ATTR2]", :long => "--attribute ATTR1 [--attribute ATTR2] ", - :proc => lambda { |val| @attrs_to_show << val }, - :description => "Show one or more attributes" + :description => "Show one or more attributes", + :proc => Proc.new { |a| + Chef::Config[:knife][:attribute] ||= [] + Chef::Config[:knife][:attribute].push(a) + } end end end diff --git a/lib/chef/knife/node_show.rb b/lib/chef/knife/node_show.rb index c616b8ab72..3092b3fc27 100644 --- a/lib/chef/knife/node_show.rb +++ b/lib/chef/knife/node_show.rb @@ -55,11 +55,6 @@ class Chef node = Chef::Node.load(@node_name) output(format_for_display(node)) - self.class.attrs_to_show = [] - end - - def self.attrs_to_show=(attrs) - @attrs_to_show = attrs end end end diff --git a/lib/chef/knife/osc_user_show.rb b/lib/chef/knife/osc_user_show.rb index 22e9bf4dcd..5350837ad3 100644 --- a/lib/chef/knife/osc_user_show.rb +++ b/lib/chef/knife/osc_user_show.rb @@ -48,7 +48,6 @@ class Chef user = Chef::User.load(@user_name) output(format_for_display(user)) end - end end end |