From 6ad9663de3c2a6c69e8bacea5e5a148b47df9eaa Mon Sep 17 00:00:00 2001 From: 1aal Date: Thu, 16 Nov 2023 22:49:57 +0800 Subject: [PATCH] fix: fix yaml unmarshal failed and display version --- pkg/cmd/addon/search.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pkg/cmd/addon/search.go b/pkg/cmd/addon/search.go index 4a9065cdd..a033ad976 100644 --- a/pkg/cmd/addon/search.go +++ b/pkg/cmd/addon/search.go @@ -8,12 +8,14 @@ import ( "regexp" "strings" - extensionsv1alpha1 "github.com/apecloud/kubeblocks/apis/extensions/v1alpha1" "github.com/spf13/cobra" - "gopkg.in/yaml.v2" + "k8s.io/apimachinery/pkg/util/yaml" "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/klog/v2" + extensionsv1alpha1 "github.com/apecloud/kubeblocks/apis/extensions/v1alpha1" + "github.com/apecloud/kubeblocks/pkg/constant" + "github.com/apecloud/kbcli/pkg/printer" "github.com/apecloud/kbcli/pkg/util" ) @@ -40,13 +42,14 @@ func newSearchCmd(streams genericiooptions.IOStreams) *cobra.Command { func search(args []string, out io.Writer) error { tbl := printer.NewTablePrinter(out) - tbl.AddRow("ADDON", "INDEX", "URL") + tbl.AddRow("ADDON", "VERSION", "INDEX") results, err := searchAddon(args[0]) if err != nil { return err } for _, res := range results { - tbl.AddRow(res.addon.Name, res.index.name, res.index.url) + label := res.addon.Labels + tbl.AddRow(res.addon.Name, label[constant.AppVersionLabelKey], res.index.name) } tbl.Print() return nil