Check for filter versions and break up box output

This commit is contained in:
Chris Roberts 2020-10-28 15:17:31 -07:00
parent baa24af179
commit 8b0790168b
2 changed files with 3 additions and 1 deletions

View File

@ -54,7 +54,7 @@ module VagrantPlugins
access_token: access_token
)
with_box(account: account, org: org, box: box_name) do |box|
if box && options[:versions]
if box && !Array(options[:versions]).empty?
box = box.versions.find_all{ |v| options[:versions].include?(v.version) }
else
box = [box]
@ -63,6 +63,7 @@ module VagrantPlugins
if !box.empty?
box.each do |b|
format_box_results(b, @env)
@env.ui.output("")
end
0
else

View File

@ -23,6 +23,7 @@ describe VagrantPlugins::CloudCommand::BoxCommand::Command::Show do
allow(ui).to receive(:warn)
allow(ui).to receive(:success)
allow(ui).to receive(:error)
allow(ui).to receive(:output)
allow(env).to receive(:ui).and_return(ui)
allow(VagrantCloud::Account).to receive(:new).
with(custom_server: anything, access_token: access_token).