commands/rdp: support extra args to RDP client [GH-3686]
This commit is contained in:
parent
9e09616d91
commit
e1815a13e8
|
@ -1,6 +1,9 @@
|
||||||
## 1.6.2 (unreleased)
|
## 1.6.2 (unreleased)
|
||||||
|
|
||||||
|
IMPROVEMENTS:
|
||||||
|
|
||||||
|
- command/rdp: Args after "--" are passed directly through to the
|
||||||
|
RDP client. [GH-3686]
|
||||||
|
|
||||||
## 1.6.1 (May 7, 2014)
|
## 1.6.1 (May 7, 2014)
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,18 @@ module VagrantPlugins
|
||||||
end
|
end
|
||||||
|
|
||||||
def execute
|
def execute
|
||||||
|
options = {}
|
||||||
|
|
||||||
opts = OptionParser.new do |o|
|
opts = OptionParser.new do |o|
|
||||||
o.banner = "Usage: vagrant rdp [options] [name]"
|
o.banner = "Usage: vagrant rdp [options] [name] [-- extra args]"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Parse out the extra args to send to the RDP client, which
|
||||||
|
# is everything after the "--"
|
||||||
|
split_index = @argv.index("--")
|
||||||
|
if split_index
|
||||||
|
options[:extra_args] = @argv.drop(split_index + 1)
|
||||||
|
@argv = @argv.take(split_index)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Parse the options and return if we don't have any target.
|
# Parse the options and return if we don't have any target.
|
||||||
|
@ -29,6 +39,9 @@ module VagrantPlugins
|
||||||
rdp_info = get_rdp_info(machine)
|
rdp_info = get_rdp_info(machine)
|
||||||
raise Errors::RDPUndetected if !rdp_info
|
raise Errors::RDPUndetected if !rdp_info
|
||||||
|
|
||||||
|
# Extra arguments if we have any
|
||||||
|
rdp_info[:extra_args] = options[:extra_args]
|
||||||
|
|
||||||
machine.ui.detail(
|
machine.ui.detail(
|
||||||
"Address: #{rdp_info[:host]}:#{rdp_info[:port]}")
|
"Address: #{rdp_info[:host]}:#{rdp_info[:port]}")
|
||||||
machine.ui.detail("Username: #{rdp_info[:username]}")
|
machine.ui.detail("Username: #{rdp_info[:username]}")
|
||||||
|
|
|
@ -22,8 +22,14 @@ module VagrantPlugins
|
||||||
end
|
end
|
||||||
config.close
|
config.close
|
||||||
|
|
||||||
|
# Build up the args to mstsc
|
||||||
|
args = [config.path]
|
||||||
|
if rdp_info[:extra_args]
|
||||||
|
args = rdp_info[:extra_args] + args
|
||||||
|
end
|
||||||
|
|
||||||
# Launch it
|
# Launch it
|
||||||
Vagrant::Util::PowerShell.execute("mstsc", config.path)
|
Vagrant::Util::PowerShell.execute("mstsc", *args)
|
||||||
ensure
|
ensure
|
||||||
config.close if config
|
config.close if config
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue