Sha256: 51f51d7ef9090eb5df97da8c966010bfa92ed143d393da2021cc36e2a33d9267

Contents?: true

Size: 882 Bytes

Versions: 7

Compression:

Stored size: 882 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 "#{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

7 entries across 7 versions & 1 rubygems

Version Path
knife-essentials-0.6.1 lib/chef/knife/show.rb
knife-essentials-0.6 lib/chef/knife/show.rb
knife-essentials-0.5.4 lib/chef/knife/show.rb
knife-essentials-0.5.3 lib/chef/knife/show.rb
knife-essentials-0.5.2 lib/chef/knife/show.rb
knife-essentials-0.5.1 lib/chef/knife/show.rb
knife-essentials-0.5 lib/chef/knife/show.rb