Sha256: 12ec56b2ec026e46a0d72427ceb9e07147743442457a862b2d5ac0d6894f23f7

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 KB

Contents

require 'optparse'

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

          opts = OptionParser.new do |opts|
            opts.banner = "Shutdown the basebox"
            opts.separator ""
            opts.separator "Usage: vagrant basebox halt <boxname>"

            opts.on("-f", "--force", "overwrite the basebox") do |f|
              options['force'] = f
            end

            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
            venv.providers["virtualbox"].get_box(argv[0]).halt(options)
          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/halt.rb
veewee-0.3.0.alpha5 lib/veewee/command/vagrant/halt.rb