diff options
author | Seth Chisamore <schisamo@opscode.com> | 2012-10-30 10:39:35 -0400 |
---|---|---|
committer | Seth Chisamore <schisamo@opscode.com> | 2012-10-30 10:39:35 -0400 |
commit | 24dc69a9a97e82a6e4207de68d6dcc664178249b (patch) | |
tree | 19bb289c9f88b4bbab066bc56b95d6d222fd5c35 /lib/chef/knife/show.rb | |
parent | 9348c1c9c80ee757354d624b7dc1b78ebc7605c4 (diff) | |
download | chef-24dc69a9a97e82a6e4207de68d6dcc664178249b.tar.gz |
[OC-3564] move core Chef to the repo root \o/ \m/
The opscode/chef repository now only contains the core Chef library code
used by chef-client, knife and chef-solo!
Diffstat (limited to 'lib/chef/knife/show.rb')
-rw-r--r-- | lib/chef/knife/show.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/chef/knife/show.rb b/lib/chef/knife/show.rb new file mode 100644 index 0000000000..7075315b08 --- /dev/null +++ b/lib/chef/knife/show.rb @@ -0,0 +1,32 @@ +require 'chef/chef_fs/knife' +require 'chef/chef_fs/file_system' + +class Chef + class Knife + class Show < Chef::ChefFS::Knife + banner "knife show [PATTERN1 ... PATTERNn]" + + common_options + + def run + # Get the matches (recursively) + pattern_args.each do |pattern| + Chef::ChefFS::FileSystem.list(chef_fs, pattern) do |result| + if result.dir? + STDERR.puts "#{result.path_for_printing}: is a directory" if pattern.exact_path + else + begin + value = result.read + puts "#{result.path_for_printing}:" + output(format_for_display(value)) + rescue Chef::ChefFS::FileSystem::NotFoundError + STDERR.puts "#{result.path_for_printing}: No such file or directory" + end + end + end + end + end + end + end +end + |