diff options
author | jkeiser <jkeiser@opscode.com> | 2013-01-19 15:12:37 -0800 |
---|---|---|
committer | John Keiser <jkeiser@opscode.com> | 2013-06-07 13:12:24 -0700 |
commit | dbc838c82a08ffe52a686ffa3f0d7962f4120b54 (patch) | |
tree | 3d8be44b3e8e57491f809f2082324fd9d659c7e6 /lib/chef/knife/diff.rb | |
parent | 7f7b3e29ccd7c081eb048a0cf81393405851987d (diff) | |
download | chef-dbc838c82a08ffe52a686ffa3f0d7962f4120b54.tar.gz |
Add knife diff --diff-filter option
Diffstat (limited to 'lib/chef/knife/diff.rb')
-rw-r--r-- | lib/chef/knife/diff.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/chef/knife/diff.rb b/lib/chef/knife/diff.rb index ccd70888b5..20d8b98ef1 100644 --- a/lib/chef/knife/diff.rb +++ b/lib/chef/knife/diff.rb @@ -24,6 +24,11 @@ class Chef :boolean => true, :description => "Only show names and statuses of modified files: Added, Deleted, Modified, and Type Changed." + option :diff_filter, + :long => '--diff-filter=[(A|D|M|T)...[*]]', + :description => "Select only files that are Added (A), Deleted (D), Modified (M), or have their type (i.e. regular file, directory) changed (T). Any combination of the filter characters (including none) can be used. When * (All-or-none) is added to the combination, all paths are selected if + there is any file that matches other criteria in the comparison; if there is no file that matches other criteria, nothing is selected." + def run if config[:name_only] output_mode = :name_only @@ -36,7 +41,7 @@ class Chef # Get the matches (recursively) error = false patterns.each do |pattern| - found_match = Chef::ChefFS::CommandLine.diff_print(pattern, chef_fs, local_fs, config[:recurse] ? nil : 1, output_mode, proc { |entry| format_path(entry) } ) do |diff| + found_match = Chef::ChefFS::CommandLine.diff_print(pattern, chef_fs, local_fs, config[:recurse] ? nil : 1, output_mode, proc { |entry| format_path(entry) }, config[:diff_filter] ) do |diff| stdout.print diff end if !found_match |