diff options
Diffstat (limited to 'lib/chef/knife/download.rb')
-rw-r--r-- | lib/chef/knife/download.rb | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/lib/chef/knife/download.rb b/lib/chef/knife/download.rb new file mode 100644 index 0000000000..f891e55530 --- /dev/null +++ b/lib/chef/knife/download.rb @@ -0,0 +1,47 @@ +require 'chef/chef_fs/knife' +require 'chef/chef_fs/command_line' + +class Chef + class Knife + class Download < Chef::ChefFS::Knife + banner "knife download PATTERNS" + + common_options + + option :recurse, + :long => '--[no-]recurse', + :boolean => true, + :default => true, + :description => "List directories recursively." + + option :purge, + :long => '--[no-]purge', + :boolean => true, + :default => false, + :description => "Delete matching local files and directories that do not exist remotely." + + option :force, + :long => '--[no-]force', + :boolean => true, + :default => false, + :description => "Force upload of files even if they match (quicker and harmless, but doesn't print out what it changed)" + + option :dry_run, + :long => '--dry-run', + :short => '-n', + :boolean => true, + :default => false, + :description => "Don't take action, only print what would happen" + + def run + patterns = pattern_args_from(name_args.length > 0 ? name_args : [ "" ]) + + # Get the matches (recursively) + patterns.each do |pattern| + Chef::ChefFS::FileSystem.copy_to(pattern, chef_fs, local_fs, config[:recurse] ? nil : 1, config) + end + end + end + end +end + |