Sha256: ba01218c27823256dfd192404fad7d610a73972ad201c2c7de58e25b17d5e0db

Contents?: true

Size: 860 Bytes

Versions: 4

Compression:

Stored size: 860 Bytes

Contents

require 'chef_fs/knife'
require 'chef_fs/file_system'

class Chef
  class Knife
    class Show < ChefFS::Knife
      banner "show [PATTERN1 ... PATTERNn]"

      common_options

      def run
        # Get the matches (recursively)
        pattern_args.each do |pattern|
          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 ChefFS::FileSystem::NotFoundError
                STDERR.puts "#{result.path_for_printing}: No such file or directory"
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
knife-essentials-0.7.3 lib/chef/knife/show.rb
knife-essentials-0.7.2 lib/chef/knife/show.rb
knife-essentials-0.7.1 lib/chef/knife/show.rb
knife-essentials-0.7 lib/chef/knife/show.rb