From 8b0790168b7f5e3da5aaa82e45eb4d03dfc57550 Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Wed, 28 Oct 2020 15:17:31 -0700 Subject: [PATCH] Check for filter versions and break up box output --- plugins/commands/cloud/box/show.rb | 3 ++- test/unit/plugins/commands/cloud/box/show_test.rb | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/commands/cloud/box/show.rb b/plugins/commands/cloud/box/show.rb index 2a52fc357..bdafc2537 100644 --- a/plugins/commands/cloud/box/show.rb +++ b/plugins/commands/cloud/box/show.rb @@ -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 diff --git a/test/unit/plugins/commands/cloud/box/show_test.rb b/test/unit/plugins/commands/cloud/box/show_test.rb index bd10cba22..623b7a048 100644 --- a/test/unit/plugins/commands/cloud/box/show_test.rb +++ b/test/unit/plugins/commands/cloud/box/show_test.rb @@ -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).