Class: VagrantPlugins::Mount::Command::Unmount

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-mount/commands/unmount.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv, env) ⇒ Unmount

Returns a new instance of Unmount.



12
13
14
15
# File 'lib/vagrant-mount/commands/unmount.rb', line 12

def initialize(argv, env)
  @env=env
  super
end

Class Method Details

.synopsisObject



8
9
10
# File 'lib/vagrant-mount/commands/unmount.rb', line 8

def self.synopsis
  'Unmount ISO from Virtual Machine'
end

Instance Method Details

#executeObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/vagrant-mount/commands/unmount.rb', line 17

def execute
  options = { remove_device: false }
  parser  = OptionParser.new do |opts|
    opts.banner = 'Usage: vagrant unmount [options] [vm-name]'
    opts.separator ''
    opts.separator '  Options:'
    opts.on("--iso path", "The path of the ISO to unmount") { |arg| options[:path] = arg }
    opts.on("--remove-device", "Remove the controller/device/port after unmounting") { |arg| options[:remove_device] = true }
  end

  argv = parse_options(parser)
  return unless argv
  argv << "default" if argv.empty?

  with_target_vms(argv) do |vm|
    vm.action(:unmount, mount_point: options[:path], remove_device: options[:remove_device])
  end
  0
end