lib/vagrant/scp/commands/scp.rb in vagrant-scp-0.4.1 vs lib/vagrant/scp/commands/scp.rb in vagrant-scp-0.4.2
- old
+ new
@@ -11,13 +11,14 @@
def execute
# Parse the arguments
file_1, file_2 = parse_args()
return if file_2.nil?
# Extract host info
- #
# We want to get the name of the vm, from a [host_1]:file_1 [host_2]:file_2 description
host = [file_1, file_2].map{|file_spec| file_spec.match(/^([^:]*):/)[1] rescue nil}.compact.first
+ # The default machine name for Vagrant is 'default'
+ host = 'default' if host.empty?
# Get the info about the target VM
with_target_vms(host) do |machine|
ssh_info = machine.ssh_info
raise Vagrant::Errors::SSHNotReady if ssh_info.nil?
@@ -44,10 +45,11 @@
end
end
def parse_args
opts = OptionParser.new do |o|
- o.banner = "Usage: vagrant scp <files> <target> [vm_name]"
+ o.banner = "Usage: vagrant scp <local_path> [vm_name]:<remote_path> \n"
+ o.banner += " vagrant scp [vm_name]:<remote_path> <local_path>"
o.separator ""
o.separator "Options:"
o.separator ""
end
argv = parse_options(opts)