Sha256: 13ddbcfe426fdae9765b988b20b3003d114c62b3eea07b38ce3b69cb390dad2c

Contents?: true

Size: 860 Bytes

Versions: 2

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]"

      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(value))
              rescue ChefFS::FileSystem::NotFoundError
                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.4 lib/chef/knife/show.rb
knife-essentials-0.3.1 lib/chef/knife/show.rb