Class: VagrantPlugins::Provider::ListCommand

Inherits:
BaseCommand
  • Object
show all
Defined in:
lib/vagrant-provider/list-command.rb

Instance Method Summary collapse

Methods inherited from BaseCommand

#active_provider, #line, #machine_folder, #machine_names, #machine_provider, #provider_name, #providers_for

Instance Method Details

#executeObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/vagrant-provider/list-command.rb', line 5

def execute
  opts = OptionParser.new do |o|
    o.banner = "Usage: vagrant provider list"
    o.separator ""
    o.separator "List all active providers"
  end

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

  line "Machines"
  line "--------"
  line

  machine_names.each do |machine_name|
    line "#{machine_name}:"
    providers_for(machine_name).each do |provider|
      line "  #{provider[:name]}" << (provider[:active] ? " (active)" : "")
    end
  end

  # Success, exit status 0
  0
end