Sha256: 90d3cfd10a02f84733a56b0d2b0c1c338e3c5fd1e3a69281c3dd5680f7a1c467

Contents?: true

Size: 967 Bytes

Versions: 1

Compression:

Stored size: 967 Bytes

Contents

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

class Chef
  class Knife
    remove_const(:Show) if const_defined?(:Show) # override Chef's version
    class Show < ::ChefFS::Knife
      ChefFS = ::ChefFS
      banner "knife 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

1 entries across 1 versions & 1 rubygems

Version Path
knife-essentials-0.8 lib/chef/knife/show_essentials.rb