fix status color
This commit is contained in:
17
main.go
17
main.go
@@ -932,7 +932,7 @@ const (
|
|||||||
totalSetupSteps = 5
|
totalSetupSteps = 5
|
||||||
remoteWindowSize = 10
|
remoteWindowSize = 10
|
||||||
remoteIndent = " "
|
remoteIndent = " "
|
||||||
remoteLineColor = ""
|
remoteLineColor = "\033[94m"
|
||||||
headerColor = "\033[1;37m"
|
headerColor = "\033[1;37m"
|
||||||
localTimeColor = "\033[0;32m"
|
localTimeColor = "\033[0;32m"
|
||||||
statusActiveColor = "\033[92m"
|
statusActiveColor = "\033[92m"
|
||||||
@@ -1172,10 +1172,10 @@ func runStatus() error {
|
|||||||
}
|
}
|
||||||
defer closeSSHControlMaster(ctx.serverIP)
|
defer closeSSHControlMaster(ctx.serverIP)
|
||||||
|
|
||||||
printInfo("Service", fmt.Sprintf("pb@%s", ctx.serviceName), remoteLineColor)
|
printInfo("Service", fmt.Sprintf("pb@%s", ctx.serviceName), "")
|
||||||
printInfo("Server", ctx.serverIP, remoteLineColor)
|
printInfo("Server", ctx.serverIP, "")
|
||||||
printInfo("Domain", ctx.domain, remoteLineColor)
|
printInfo("Domain", ctx.domain, "")
|
||||||
printInfo("Port", fmt.Sprintf("%d", ctx.port), remoteLineColor)
|
printInfo("Port", fmt.Sprintf("%d", ctx.port), "")
|
||||||
|
|
||||||
props, err := querySystemdProperties(ctx)
|
props, err := querySystemdProperties(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -1193,7 +1193,7 @@ func runStatus() error {
|
|||||||
printInfo("Status", statusLine, statusColorFor(state))
|
printInfo("Status", statusLine, statusColorFor(state))
|
||||||
|
|
||||||
if pid := strings.TrimSpace(props["ExecMainPID"]); pid != "" && pid != "0" {
|
if pid := strings.TrimSpace(props["ExecMainPID"]); pid != "" && pid != "0" {
|
||||||
printInfo("PID", pid, remoteLineColor)
|
printInfo("PID", pid, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
if memCurrent, ok := parseSystemdBytes(props["MemoryCurrent"]); ok {
|
if memCurrent, ok := parseSystemdBytes(props["MemoryCurrent"]); ok {
|
||||||
@@ -1201,7 +1201,7 @@ func runStatus() error {
|
|||||||
if memPeak, ok := parseSystemdBytes(props["MemoryPeak"]); ok {
|
if memPeak, ok := parseSystemdBytes(props["MemoryPeak"]); ok {
|
||||||
memLine = fmt.Sprintf("%s (peak: %s)", memLine, formatBytes(memPeak))
|
memLine = fmt.Sprintf("%s (peak: %s)", memLine, formatBytes(memPeak))
|
||||||
}
|
}
|
||||||
printInfo("Memory", memLine, remoteLineColor)
|
printInfo("Memory", memLine, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
if started := strings.TrimSpace(props["ActiveEnterTimestamp"]); started != "" {
|
if started := strings.TrimSpace(props["ActiveEnterTimestamp"]); started != "" {
|
||||||
@@ -1216,9 +1216,6 @@ func runStatus() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func printInfo(label, value, valueColor string) {
|
func printInfo(label, value, valueColor string) {
|
||||||
if valueColor == "" {
|
|
||||||
valueColor = remoteLineColor
|
|
||||||
}
|
|
||||||
fmt.Printf("%s%s:%s %s%s%s\n", headerColor, label, remoteColorReset, valueColor, value, remoteColorReset)
|
fmt.Printf("%s%s:%s %s%s%s\n", headerColor, label, remoteColorReset, valueColor, value, remoteColorReset)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user