Sha256: e403dcc55c573808f0c85a0f8d3770817ca7df86df7c24070d10be17cc1b9e3d

Contents?: true

Size: 601 Bytes

Versions: 32

Compression:

Stored size: 601 Bytes

Contents

module VagrantPlugins
  module CommunicatorWinRM
    module CommandFilters
      # Converts a *nix 'which' command to a PowerShell equivalent
      class Which
        def filter(command)
          executable = command.strip.split(/\s+/)[1]
          return <<-EOH
            $command = [Array](Get-Command #{executable} -errorAction SilentlyContinue)
            if ($null -eq $command) { exit 1 }
            write-host $command[0].Definition
            exit 0
          EOH
        end

        def accept?(command)
          command.start_with?('which ')
        end
      end
    end
  end
end

Version data entries

32 entries across 29 versions & 6 rubygems

Version Path
vagrant-unbundled-2.0.3.0 plugins/communicators/winrm/command_filters/which.rb
vagrant-aws-detiber-0.7.2.pre.4 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-419afb4dcffe/plugins/communicators/winrm/command_filters/which.rb
vagrant-aws-detiber-0.7.2.pre.3 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-419afb4dcffe/plugins/communicators/winrm/command_filters/which.rb
vagrant-aws-detiber-0.7.2.pre.2 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-419afb4dcffe/plugins/communicators/winrm/command_filters/which.rb
vagrant-unbundled-2.0.2.0 plugins/communicators/winrm/command_filters/which.rb
vagrant-unbundled-2.0.1.0 plugins/communicators/winrm/command_filters/which.rb
vagrant-aws-mkubenka-0.7.2.pre.22 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-f3fdbf414272/plugins/communicators/winrm/command_filters/which.rb
vagrant-aws-mkubenka-0.7.2.pre.16 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-1ee58c40e3f5/plugins/communicators/winrm/command_filters/which.rb
vagrant-unbundled-2.0.0.1 plugins/communicators/winrm/command_filters/which.rb
vagrant-unbundled-1.9.8.1 plugins/communicators/winrm/command_filters/which.rb
vagrant-unbundled-1.9.7.1 plugins/communicators/winrm/command_filters/which.rb
vagrant-aws-mkubenka-0.7.2.pre.14 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/plugins/communicators/winrm/command_filters/which.rb
vagrant-aws-mkubenka-0.7.2.pre.11 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/plugins/communicators/winrm/command_filters/which.rb
vagrant-aws-mkubenka-0.7.2.pre.10 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/plugins/communicators/winrm/command_filters/which.rb
vagrant-aws-mkubenka-0.7.2.pre.9 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/plugins/communicators/winrm/command_filters/which.rb
vagrant-unbundled-1.9.5.1 plugins/communicators/winrm/command_filters/which.rb
vagrant-unbundled-1.9.1.1 plugins/communicators/winrm/command_filters/which.rb
vagrant-compose-yaml-0.1.3 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/plugins/communicators/winrm/command_filters/which.rb
vagrant-compose-yaml-0.1.2 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/plugins/communicators/winrm/command_filters/which.rb
vagrant-compose-yaml-0.1.1 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/plugins/communicators/winrm/command_filters/which.rb