<commit_before>
module VagrantPlugins
  module Scp
    module Command

      class Scp < Vagrant.plugin(2, :command)

        def self.synopsis
          "copies data into a box via SCP"
        end

        def execute
          @file_1, @file_2 = parse_args()
          return if @file_2.nil?

          with_target_vms(host) do |machine|
            @ssh_info = machine.ssh_info
            raise Vagrant::Errors::SSHNotReady if @ssh_info.nil?
            user_at_host = "#{@ssh_info[:username]}@#{@ssh_info[:host]}"
            if net_ssh_command == :upload!
              target = "#{user_at_host}:'#{target_files}'"
              source = "'#{source_files}'"
            else
              target = "'#{target_files}'"
              source = "#{user_at_host}:'#{source_files}'"
            end
            command = [
              "scp",
              "-r",
              "-o StrictHostKeyChecking=no",
              "-o UserKnownHostsFile=/dev/null",
              "-o port=#{@ssh_info[:port]}",
              "-i '#{@ssh_info[:private_key_path][0]}'",
              source,
              target
            ].join(' ')
            system(command)
          end
        end

        private<commit_msg>Add ProxyCommand support, fixes #18<commit_after>
module VagrantPlugins
  module Scp
    module Command

      class Scp < Vagrant.plugin(2, :command)

        def self.synopsis
          "copies data into a box via SCP"
        end

        def execute
          @file_1, @file_2 = parse_args()
          return if @file_2.nil?

          with_target_vms(host) do |machine|
            @ssh_info = machine.ssh_info
            raise Vagrant::Errors::SSHNotReady if @ssh_info.nil?
            user_at_host = "#{@ssh_info[:username]}@#{@ssh_info[:host]}"
            if net_ssh_command == :upload!
              target = "#{user_at_host}:'#{target_files}'"
              source = "'#{source_files}'"
            else
              target = "'#{target_files}'"
              source = "#{user_at_host}:'#{source_files}'"
            end

            if @ssh_info[:proxy_command]
              proxy_command = "-o ProxyCommand='#{@ssh_info[:proxy_command]}'"
            else
              proxy_command = ''
            end

            command = [
              "scp",
              "-r",
              "-o StrictHostKeyChecking=no",
              "-o UserKnownHostsFile=/dev/null",
              "-o port=#{@ssh_info[:port]}",
              proxy_command,
              "-i '#{@ssh_info[:private_key_path][0]}'",
              source,
              target
            ].join(' ')
            system(command)
          end
        end

        private
{'fraction_non_alphanumeric': 0.12485896953742008, 'fraction_numerical': 0.0045129748025573525, 'mean_word_length': 1.523719165085389, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4800108', 'n_tokens_mistral': 807, 'n_tokens_neox': 784, 'n_words': 154}