Sha256: bb3eec9fd1c718ea10a3ac3d8574b69d31b0ed3b3b1d7f94d2855ac6dc2b2449

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

require 'optparse'

module Veewee
  module Command
    module Vagrant
      class Undefine < ::Vagrant::Command::Base
        def execute
          options = {}

          opts = OptionParser.new do |opts|
            opts.banner = "Remove the definition of a basebox"
            opts.separator ""
            opts.separator "Usage: vagrant basebox undefine <boxname>"

            opts.on("-d", "--debug", "enable debugging") do |d|
              options['debug'] = d
            end

          end

          # Parse the options
          argv = parse_options(opts)
          return if !argv
          raise ::Vagrant::Errors::CLIInvalidUsage, :help => opts.help.chomp if argv.length < 1

          begin
            venv=Veewee::Environment.new(options)
            venv.ui=@env.ui
            definition_name=argv[0]
            venv.definitions.undefine(definition_name,options)
            venv.ui.info "Definitio '#{definition_name}' succesfully removed"
          rescue Veewee::Error => ex
            venv.ui.error ex
            exit -1
          end

        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
veewee-0.3.0.alpha6 lib/veewee/command/vagrant/undefine.rb
veewee-0.3.0.alpha5 lib/veewee/command/vagrant/undefine.rb