File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -121,7 +121,7 @@ def self.list_commands(preferred_category=nil)
121121 def self . run ( args , options = { } )
122122 load_commands
123123 subcommand_class = subcommand_class_from ( args )
124- subcommand_class . options . merge! ( options )
124+ subcommand_class . options = options . merge! ( subcommand_class . options )
125125 instance = subcommand_class . new ( args )
126126 instance . configure_chef
127127 instance . run
@@ -324,6 +324,13 @@ def format_for_display(item)
324324 elsif config [ :run_list ]
325325 data = data . run_list . run_list
326326 { "run_list" => data }
327+ elsif config [ :environment ]
328+ if data . class == Chef ::Node
329+ { "chef_environment" => data . chef_environment }
330+ else
331+ # this is a place holder for now. Feel free to modify (i.e. add other cases). [nuo]
332+ data
333+ end
327334 elsif config [ :id_only ]
328335 data . respond_to? ( :name ) ? data . name : data [ "id" ]
329336 else
Original file line number Diff line number Diff line change @@ -35,6 +35,11 @@ class NodeShow < Knife
3535 :short => "-r" ,
3636 :long => "--run-list" ,
3737 :description => "Show only the run list"
38+
39+ option :environment ,
40+ :short => "-E" ,
41+ :long => "--environment" ,
42+ :description => "Show only the Chef environment"
3843
3944 def run
4045 @node_name = @name_args [ 0 ]
Original file line number Diff line number Diff line change 2424 @knife = Chef ::Knife ::NodeShow . new
2525 @knife . config = {
2626 :attribute => nil ,
27- :run_list => nil
27+ :run_list => nil ,
28+ :environment => nil
2829 }
2930 @knife . name_args = [ "adam" ]
3031 @knife . stub! ( :output ) . and_return ( true )
You can’t perform that action at this time.
0 commit comments