Sha256: 845ead0fc6cd12e8f05071518135333b0c50224635b48d879602d58894c62230

Contents?: true

Size: 870 Bytes

Versions: 2

Compression:

Stored size: 870 Bytes

Contents

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

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

      def run
        # Get the matches (recursively)
        pattern_args.each do |pattern|
          ChefFS::FileSystem.list(chef_fs, pattern) do |result|
            if result.dir?
              STDERR.puts "#{format_path(result.path)}: is a directory" if pattern.exact_path
            else
              begin
                value = result.read
                puts "#{format_path(result.path)}:"
                output(format_for_display(result.read))
              rescue ChefFS::FileSystem::NotFoundException
                STDERR.puts "#{format_path(result.path)}: No such file or directory" if pattern.exact_path
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
knife-essentials-0.1.1 lib/chef/knife/show.rb
knife-essentials-0.1 lib/chef/knife/show.rb