Module: Chef::Knife::Core::MultiAttributeReturnOption

Included in:
Chef::Knife::ClientShow, EnvironmentShow, NodeShow, OscUserShow, RoleShow, Search, UserShow
Defined in:
lib/chef/knife/core/generic_presenter.rb

Overview

Allows includer knife commands to return multiple attributes

Class Method Summary collapse

Class Method Details

.included(includer) ⇒ Object

:nodoc:


29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/chef/knife/core/generic_presenter.rb', line 29

def self.included(includer)
  includer.class_eval do
    option :field_separator,
      :short => "-S SEPARATOR",
      :long => "--field-separator SEPARATOR",
      :description => "Character separator used to delineate nesting in --attribute filters (default \".\")"

    option :attribute,
      :short => "-a ATTR1 [-a ATTR2]",
      :long => "--attribute ATTR1 [--attribute ATTR2] ",
      :description => "Show one or more attributes",
      :proc => Proc.new { |a|
        Chef::Config[:knife][:attribute] ||= []
        Chef::Config[:knife][:attribute].push(a)
      }
  end
end