diff options
author | John Keiser <jkeiser@opscode.com> | 2013-04-05 23:15:35 -0700 |
---|---|---|
committer | John Keiser <jkeiser@opscode.com> | 2013-06-07 13:12:30 -0700 |
commit | 9407da63cbe0416c0c5f5ffe96b9c69fc04d1358 (patch) | |
tree | 041c623bb6607baa615fac014924ffa3c102c88e /lib | |
parent | 1eacecda5bd07ba45f38f291d73cc3708ca82b82 (diff) | |
download | chef-9407da63cbe0416c0c5f5ffe96b9c69fc04d1358.tar.gz |
Add xargs -t to print command lines
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chef/knife/xargs.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/chef/knife/xargs.rb b/lib/chef/knife/xargs.rb index 46471f2252..c47ba00baf 100644 --- a/lib/chef/knife/xargs.rb +++ b/lib/chef/knife/xargs.rb @@ -54,6 +54,10 @@ class Chef :short => '-s LENGTH', :description => "Maximum size of command line, in characters" + option :verbose_commands, + :short => '-t', + :description => "Print command to be run on the command line" + def run error = false # Get the matches (recursively) @@ -193,9 +197,12 @@ class Chef return error if error && tempfiles.size == 0 # Run the command - output sub_filenames(command, tempfiles) + if config[:verbose_commands] || Chef::Config[:verbosity] && Chef::Config[:verbosity] >= 1 + output sub_filenames(command, tempfiles) + end command_output = `#{command}` command_output = sub_filenames(command_output, tempfiles) + output command_output # Check if the output is different tempfiles.each_pair do |tempfile, file| |