lib/vagrant-winrm/commands/winrm.rb in vagrant-winrm-0.4.0 vs lib/vagrant-winrm/commands/winrm.rb in vagrant-winrm-0.5.0

- old
+ new

@@ -18,10 +18,14 @@ o.on('-c', '--command COMMAND', 'Execute a WinRM command directly') do |c| options[:command] = Array.new if options[:command].nil? options[:command].push c end + o.on('-e', '--elevated', 'Run all commands with elevated credentials') do |e| + options[:elevated] = true + end + o.on('-s', '--shell SHELL', [:powershell, :cmd], 'Use the specified shell (powershell, cmd)') do |s| options[:shell] = s end o.on('--plugin-version', 'Print the version of the plugin and exit') do @@ -49,10 +53,10 @@ exit_code = 0 @logger.debug("Executing a batch of #{options[:command].length} on remote machine with #{options[:shell]}") options[:command].each do |c| @logger.debug("Executing command: #{c}") - exit_code |= vm.communicate.execute(c, shell: options[:shell]) { |type, data| (type == :stderr ? $stderr : $stdout).print data } + exit_code |= vm.communicate.execute(c, shell: options[:shell], elevated: options[:elevated]) { |type, data| (type == :stderr ? $stderr : $stdout).print data } end return exit_code end end end