From dd2d7b1b52d82f0240ce6656033f06c390b7ef24 Mon Sep 17 00:00:00 2001 From: Preslav Gerchev Date: Fri, 23 Feb 2024 16:11:44 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20shell:=20select=20asset=20?= =?UTF-8?q?if=20just=20one.=20(#3416)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Preslav --- apps/cnquery/cmd/shell.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/cnquery/cmd/shell.go b/apps/cnquery/cmd/shell.go index 224ff27a1b..a96e70df6a 100644 --- a/apps/cnquery/cmd/shell.go +++ b/apps/cnquery/cmd/shell.go @@ -107,7 +107,9 @@ func StartShell(runtime *providers.Runtime, conf *ShellConfig) error { } var connectAsset *scan.AssetWithRuntime - if len(filteredAssets) > 1 { + if len(filteredAssets) == 1 { + connectAsset = filteredAssets[0] + } else if len(filteredAssets) > 1 { invAssets := make([]*inventory.Asset, 0, len(filteredAssets)) for _, a := range filteredAssets { invAssets = append(invAssets, a.Asset)