summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorjkeiser <jkeiser@opscode.com>2012-11-21 11:39:45 -0800
committerBryan McLellan <btm@opscode.com>2012-12-03 10:00:56 -0800
commit7fbf9c89325312ab91c73a65cdc3a1869760012e (patch)
treed58770cb1bd5d8083e672e4b92be1fffd8bc68c6 /lib
parent713e23b85ef27ebb775dfa1386f040b197cbc18e (diff)
downloadchef-7fbf9c89325312ab91c73a65cdc3a1869760012e.tar.gz
Complain if no arguments are specified to upload or download
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/knife/download.rb9
-rw-r--r--lib/chef/knife/upload.rb9
2 files changed, 12 insertions, 6 deletions
diff --git a/lib/chef/knife/download.rb b/lib/chef/knife/download.rb
index f891e55530..dc2588b6b5 100644
--- a/lib/chef/knife/download.rb
+++ b/lib/chef/knife/download.rb
@@ -34,10 +34,13 @@ class Chef
:description => "Don't take action, only print what would happen"
def run
- patterns = pattern_args_from(name_args.length > 0 ? name_args : [ "" ])
+ if name_args.length == 0
+ show_usage
+ ui.fatal("Must specify at least one argument. If you want to download everything in this directory, type \"knife download .\"")
+ exit 1
+ end
- # Get the matches (recursively)
- patterns.each do |pattern|
+ pattern_args.each do |pattern|
Chef::ChefFS::FileSystem.copy_to(pattern, chef_fs, local_fs, config[:recurse] ? nil : 1, config)
end
end
diff --git a/lib/chef/knife/upload.rb b/lib/chef/knife/upload.rb
index ff8616543e..bb1e365798 100644
--- a/lib/chef/knife/upload.rb
+++ b/lib/chef/knife/upload.rb
@@ -34,10 +34,13 @@ class Chef
:description => "Don't take action, only print what would happen"
def run
- patterns = pattern_args_from(name_args.length > 0 ? name_args : [ "" ])
+ if name_args.length == 0
+ show_usage
+ ui.fatal("Must specify at least one argument. If you want to upload everything in this directory, type \"knife upload .\"")
+ exit 1
+ end
- # Get the matches (recursively)
- patterns.each do |pattern|
+ pattern_args.each do |pattern|
Chef::ChefFS::FileSystem.copy_to(pattern, local_fs, chef_fs, config[:recurse] ? nil : 1, config)
end
end