dev
This commit is contained in:
parent
4033869b5d
commit
8c6a6b03b9
17
cmd/ps.go
17
cmd/ps.go
|
@ -10,8 +10,6 @@ import (
|
||||||
|
|
||||||
"git.apinb.com/bsm-sdk/engine/env"
|
"git.apinb.com/bsm-sdk/engine/env"
|
||||||
"git.apinb.com/bsm-sdk/engine/utils"
|
"git.apinb.com/bsm-sdk/engine/utils"
|
||||||
"git.apinb.com/bsm-sdk/engine/vars"
|
|
||||||
"github.com/golistic/boxed"
|
|
||||||
"github.com/modood/table"
|
"github.com/modood/table"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
@ -45,7 +43,6 @@ type PsTable struct {
|
||||||
Performance string
|
Performance string
|
||||||
CurrentVersion string `table:"Current Version"`
|
CurrentVersion string `table:"Current Version"`
|
||||||
RegisterVersion string `table:"Register Version"`
|
RegisterVersion string `table:"Register Version"`
|
||||||
UpdatedAt string `table:"Updated At"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var psCmd = &cobra.Command{
|
var psCmd = &cobra.Command{
|
||||||
|
@ -75,25 +72,11 @@ func psExecute() {
|
||||||
srvLine.ServiceKey = v.ServiceKey
|
srvLine.ServiceKey = v.ServiceKey
|
||||||
srvLine.Origin = v.Origin
|
srvLine.Origin = v.Origin
|
||||||
srvLine.RegisterVersion = v.Version
|
srvLine.RegisterVersion = v.Version
|
||||||
srvLine.UpdatedAt = v.UpdatedAt.Format(vars.YYYY_MM_DD_HH_MM_SS)
|
|
||||||
pt = append(pt, srvLine)
|
pt = append(pt, srvLine)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Output to stdout
|
// Output to stdout
|
||||||
table.Output(pt)
|
table.Output(pt)
|
||||||
print(pt)
|
|
||||||
}
|
|
||||||
|
|
||||||
func print(pt []PsTable) {
|
|
||||||
box := boxed.New()
|
|
||||||
|
|
||||||
_ = box.AddHeader("Service Key", "Origin", "Status", "PID", "Performance", "Local Version", "Registry Version", "Updated At")
|
|
||||||
for _, v := range pt {
|
|
||||||
_ = box.Append(
|
|
||||||
boxed.NewRow(v.ServiceKey, v.Origin, v.Status, v.PID, v.Performance, v.CurrentVersion, v.RegisterVersion, v.UpdatedAt))
|
|
||||||
}
|
|
||||||
|
|
||||||
_ = box.Render()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func getSrvStatus(srv string) PsTable {
|
func getSrvStatus(srv string) PsTable {
|
||||||
|
|
Loading…
Reference in New Issue