summaryrefslogtreecommitdiff
path: root/lib/chef/knife/upload.rb
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/chef/knife/upload.rb
parent713e23b85ef27ebb775dfa1386f040b197cbc18e (diff)
downloadchef-7fbf9c89325312ab91c73a65cdc3a1869760012e.tar.gz
Complain if no arguments are specified to upload or download
Diffstat (limited to 'lib/chef/knife/upload.rb')
-rw-r--r--lib/chef/knife/upload.rb9
1 files changed, 6 insertions, 3 deletions
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