Class: VagrantPlugins::Protobox::Command::Switch

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-protobox/command/switch.rb

Instance Method Summary collapse

Instance Method Details

#executeObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/vagrant-protobox/command/switch.rb', line 7

def execute
  options = { verbose: false }

  opts = OptionParser.new do |o|
    o.banner = "Usage: vagrant protobox switch <config>"
    #o.separator ""
    #o.separator "Options:"
    #o.separator ""
  end

  # Parse the options
  argv = parse_options(opts)
  return if !argv

  if argv.empty? || argv.length > 1
    raise Vagrant::Errors::CLIInvalidUsage,
      help: opts.help.chomp
  end

  config = argv[0]

  @env.action_runner.run(Protobox::Action.action_switch, {
    config_name: config,
    ui: Vagrant::UI::Prefixed.new(@env.ui, "protobox"),
  })

  # Success, exit status 0
  0
end