This commit is contained in:
david 2024-03-02 00:05:57 +08:00
parent 8ccc60327d
commit f1e51a41ef
1 changed files with 5 additions and 12 deletions

View File

@ -13,7 +13,6 @@ import (
"git.apinb.com/bsm-sdk/engine/vars" "git.apinb.com/bsm-sdk/engine/vars"
"github.com/modood/table" "github.com/modood/table"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/subchen/go-tableify"
) )
type JSONData struct { type JSONData struct {
@ -38,14 +37,13 @@ type ActionsReleases struct {
} }
type PsTable struct { type PsTable struct {
ServiceKey string `tableify:"Service Key"` ServiceKey string `table:"Service Key"`
Origin string Origin string
Status string Status string
PID string
Performance string Performance string
CurrentVersion string `tableify:"Current Version"` CurrentVersion string `table:"Current Version"`
RegisterVersion string `tableify:"Register Version"` RegisterVersion string `table:"Register Version"`
UpdatedAt string `tableify:"Updated At"` UpdatedAt string `table:"Updated At"`
} }
var psCmd = &cobra.Command{ var psCmd = &cobra.Command{
@ -80,10 +78,6 @@ func psExecute() {
} }
// Output to stdout // Output to stdout
t := tableify.New()
t.SetHeadersFromStruct(new(PsTable))
t.AddRowObjectList(pt)
t.Print()
table.Output(pt) table.Output(pt)
} }
@ -100,12 +94,11 @@ func getSrvStatus(srv string) PsTable {
status = "\033[31mStop\033[0m\n" status = "\033[31mStop\033[0m\n"
} }
pid, cm := getProcessInfo(srv) _, cm := getProcessInfo(srv)
return PsTable{ return PsTable{
Status: status, Status: status,
CurrentVersion: getCurrentVersion(srv), CurrentVersion: getCurrentVersion(srv),
PID: pid,
Performance: cm, Performance: cm,
} }