Sha256: c2034180bb1bebf4869730252a29fe442f09a14122554af274df276bb417d22c

Contents?: true

Size: 1.2 KB

Versions: 16

Compression:

Stored size: 1.2 KB

Contents

require 'chef/chef_fs/knife'
require 'chef/chef_fs/command_line'

class Chef
  class Knife
    class Diff < Chef::ChefFS::Knife
      banner "knife diff PATTERNS"

      common_options

      option :recurse,
        :long => '--[no-]recurse',
        :boolean => true,
        :default => true,
        :description => "List directories recursively."

      option :name_only,
        :long => '--name-only',
        :boolean => true,
        :description => "Only show names of modified files."

      option :name_status,
        :long => '--name-status',
        :boolean => true,
        :description => "Only show names and statuses of modified files: Added, Deleted, Modified, and Type Changed."

      def run
        if config[:name_only]
          output_mode = :name_only
        end
        if config[:name_status]
          output_mode = :name_status
        end
        patterns = pattern_args_from(name_args.length > 0 ? name_args : [ "" ])

        # Get the matches (recursively)
        patterns.each do |pattern|
          Chef::ChefFS::CommandLine.diff(pattern, chef_fs, local_fs, config[:recurse] ? nil : 1, output_mode) do |diff|
            puts diff
          end
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
chef-11.4.4 lib/chef/knife/diff.rb
chef-11.4.2 lib/chef/knife/diff.rb
microwave-11.400.8 lib/chef/knife/diff.rb
microwave-11.400.7 lib/chef/knife/diff.rb
microwave-11.400.6 lib/chef/knife/diff.rb
microwave-11.400.5 lib/chef/knife/diff.rb
microwave-11.400.4 lib/chef/knife/diff.rb
chef-11.4.0 lib/chef/knife/diff.rb
chef-11.4.0.rc.0 lib/chef/knife/diff.rb
chef-11.0.0.beta.2 lib/chef/knife/diff.rb
chef-11.2.0 lib/chef/knife/diff.rb
chef-11.2.0.rc.1 lib/chef/knife/diff.rb
chef-11.0.0 lib/chef/knife/diff.rb
chef-11.0.0.rc.0 lib/chef/knife/diff.rb
chef-11.0.0.beta.1 lib/chef/knife/diff.rb
chef-11.0.0.beta.0 lib/chef/knife/diff.rb