Sha256: da23b59d1e694f4ff473491c0fbf67a2640d144b6555e6cc8b494fbff18169c9
Contents?: true
Size: 1.82 KB
Versions: 2
Compression:
Stored size: 1.82 KB
Contents
module VagrantPlugins module Openstack module Command COMMANDS = [ { name: :'image-list', file: 'image_list' , clazz: 'ImageList' }, { name: :'flavor-list', file: 'flavor_list', clazz: 'FlavorList' }, { name: :'network-list', file: 'network_list', clazz: 'NetworkList' }, { name: :'subnet-list', file: 'subnet_list', clazz: 'SubnetList' }, { name: :'floatingip-list', file: 'floatingip_list', clazz: 'FloatingIpList' }, { name: :'volume-list', file: 'volume_list', clazz: 'VolumeList' }, { name: :'reset', file: 'reset', clazz: 'Reset' } ] class Main < Vagrant.plugin('2', :command) def self.synopsis Openstack.init_i18n I18n.t('vagrant_openstack.command.main_synopsis') end def initialize(argv, env) @env = env @main_args, @sub_command, @sub_args = split_main_and_subcommand(argv) @commands = Vagrant::Registry.new COMMANDS.each do |cmd| @commands.register(cmd[:name]) do require_relative cmd[:file] Command.const_get(cmd[:clazz]) end end super(argv, env) end def execute Openstack.init_i18n command_class = @commands.get(@sub_command.to_sym) if @sub_command return usage unless command_class && @sub_command command_class.new(@sub_args, @env).execute(@sub_command) end def usage @env.ui.info I18n.t('vagrant_openstack.command.main_usage') @env.ui.info '' @env.ui.info I18n.t('vagrant_openstack.command.available_subcommands') @commands.each do |key, value| @env.ui.info " #{key.to_s.ljust(20)} #{value.synopsis}" end @env.ui.info '' end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
vagrant-openstack-provider-0.6.1 | lib/vagrant-openstack-provider/command/main.rb |
vagrant-openstack-provider-0.6.0 | lib/vagrant-openstack-provider/command/main.rb |