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