Sha256: 2b522d798a9cad3ae043c0d0679b51778bf7e80c93ea83c0e5eb3be6d2a5c00e
Contents?: true
Size: 900 Bytes
Versions: 19
Compression:
Stored size: 900 Bytes
Contents
require 'optparse' module Vagrant module Command class BoxAdd < Base def execute options = {} opts = OptionParser.new do |opts| opts.banner = "Usage: vagrant box add <name> <url>" opts.separator "" opts.on("-f", "--force", "Overwrite an existing box if it exists.") do |f| options[:force] = f end end # Parse the options argv = parse_options(opts) return if !argv raise Errors::CLIInvalidUsage, :help => opts.help.chomp if argv.length < 2 # If we're force adding, then be sure to destroy any existing box if it # exists. if options[:force] existing = @env.boxes.find(argv[0]) existing.destroy if existing end @env.boxes.add(argv[0], argv[1]) # Success, exit status 0 0 end end end end
Version data entries
19 entries across 19 versions & 6 rubygems