Skip to content

Commit

Permalink
fix: fix yaml unmarshal failed and display version
Browse files Browse the repository at this point in the history
  • Loading branch information
1aal committed Nov 16, 2023
1 parent c9effbd commit 6ad9663
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions pkg/cmd/addon/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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
Expand Down

0 comments on commit 6ad9663

Please sign in to comment.