Sha256: 41f815ce8034d38bf9f86da4fe04cf4bfb6caab61a3cbe158a04525739f1a380

Contents?: true

Size: 591 Bytes

Versions: 2

Compression:

Stored size: 591 Bytes

Contents

module VagrantWindows
  module Communication
    module CommandFilters

      # Converts a *nix 'rm' command to a PowerShell equivalent
      class Rm

        def filter(command)
          # rm -Rf /some/dir
          # rm /some/dir
          cmd_parts = command.strip.split(/\s+/)
          dir = cmd_parts[1]
          if dir == '-Rf'
            dir = cmd_parts[2]
            return "rm '#{dir}' -recurse -force"
          end
          return "rm '#{dir}' -force"
        end

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

      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vagrant-windows-1.7.0.pre.2 lib/vagrant-windows/communication/command_filters/rm.rb
vagrant-windows-1.7.0.pre.1 lib/vagrant-windows/communication/command_filters/rm.rb