Add the --provider optional flag to `box add`
This commit is contained in:
parent
2d8a048946
commit
124a2ee5d3
|
@ -27,7 +27,7 @@ module Vagrant
|
|||
# Add the box
|
||||
env[:ui].info I18n.t("vagrant.actions.box.add.adding", :name => env[:box_name])
|
||||
begin
|
||||
env[:box_collection].add(@temp_path, env[:box_name])
|
||||
env[:box_collection].add(@temp_path, env[:box_name], env[:box_provider])
|
||||
rescue Vagrant::Errors::BoxUpgradeRequired
|
||||
# Upgrade the box
|
||||
env[:box_collection].upgrade(env[:box_name])
|
||||
|
|
|
@ -8,12 +8,17 @@ module VagrantPlugins
|
|||
options = {}
|
||||
|
||||
opts = OptionParser.new do |o|
|
||||
o.banner = "Usage: vagrant box add <name> <url>"
|
||||
o.banner = "Usage: vagrant box add <name> <url> [--provider provider] [-h]"
|
||||
o.separator ""
|
||||
|
||||
o.on("-f", "--force", "Overwrite an existing box if it exists.") do |f|
|
||||
options[:force] = f
|
||||
end
|
||||
|
||||
o.on("--provider provider", String,
|
||||
"The provider that backs the box.") do |p|
|
||||
options[:provider] = p
|
||||
end
|
||||
end
|
||||
|
||||
# Parse the options
|
||||
|
@ -30,7 +35,7 @@ module VagrantPlugins
|
|||
|
||||
@env.action_runner.run(Vagrant::Action.action_box_add, {
|
||||
:box_name => argv[0],
|
||||
:box_provider => :virtualbox,
|
||||
:box_provider => options[:provider].to_sym,
|
||||
:box_url => argv[1]
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue