Fix: top command abnormal render (#6174)

* Fix: top command abnormal render

Signed-off-by: iyear <ljyngup@gmail.com>

* Fix: imports

Signed-off-by: iyear <ljyngup@gmail.com>

* Fix: gomod

Signed-off-by: iyear <ljyngup@gmail.com>

---------

Signed-off-by: iyear <ljyngup@gmail.com>
This commit is contained in:
iyear
2023-07-04 12:09:02 +08:00
committed by GitHub
parent 2808de4733
commit 64e4ab813d
2 changed files with 4 additions and 1 deletions

2
go.mod
View File

@@ -40,6 +40,7 @@ require (
github.com/kubevela/workflow v0.5.1-0.20230412142834-be9e5a10baf0 github.com/kubevela/workflow v0.5.1-0.20230412142834-be9e5a10baf0
github.com/kyokomi/emoji v2.2.4+incompatible github.com/kyokomi/emoji v2.2.4+incompatible
github.com/magiconair/properties v1.8.7 github.com/magiconair/properties v1.8.7
github.com/mattn/go-runewidth v0.0.14
github.com/mitchellh/hashstructure/v2 v2.0.2 github.com/mitchellh/hashstructure/v2 v2.0.2
github.com/nacos-group/nacos-sdk-go/v2 v2.2.2 github.com/nacos-group/nacos-sdk-go/v2 v2.2.2
github.com/oam-dev/cluster-gateway v1.9.0-alpha.2 github.com/oam-dev/cluster-gateway v1.9.0-alpha.2
@@ -207,7 +208,6 @@ require (
github.com/mailru/easyjson v0.7.7 // indirect github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect github.com/mattn/go-isatty v0.0.17 // indirect
github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect

View File

@@ -20,6 +20,7 @@ import (
"fmt" "fmt"
"github.com/go-logr/logr" "github.com/go-logr/logr"
"github.com/mattn/go-runewidth"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"k8s.io/klog/v2" "k8s.io/klog/v2"
"sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/log"
@@ -46,6 +47,8 @@ func NewTopCommand(c common.Args, order string, ioStreams cmdutil.IOStreams) *co
vela top -A vela top -A
`, `,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
runewidth.DefaultCondition.EastAsianWidth = false // https://github.com/rivo/tview/issues/118
namespace, err := GetFlagNamespaceOrEnv(cmd, c) namespace, err := GetFlagNamespaceOrEnv(cmd, c)
if err != nil { if err != nil {
return err return err