# File lib/chef/knife.rb, line 284 def output(data) case config[:format] when "json", nil stdout.puts JSON.pretty_generate(data) when "yaml" require 'yaml' stdout.puts YAML::dump(data) when "text" # If you were looking for some attribute and there is only one match # just dump the attribute value if data.length == 1 and config[:attribute] stdout.puts data.values[0] else PP.pp(data, stdout) end else raise ArgumentError, "Unknown output format #{config[:format]}" end end