From 28e3c8bd3ff3167a0c3084f353481b930c137471 Mon Sep 17 00:00:00 2001 From: Aayush Rajasekaran Date: Thu, 29 Jul 2021 11:46:42 -0400 Subject: [PATCH 1/2] Improve formatting of workers CLI --- cmd/lotus-miner/sealing.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/lotus-miner/sealing.go b/cmd/lotus-miner/sealing.go index 3bf4c675f..e38d2de0f 100644 --- a/cmd/lotus-miner/sealing.go +++ b/cmd/lotus-miner/sealing.go @@ -91,7 +91,10 @@ var sealingWorkersCmd = &cli.Command{ var barCols = uint64(64) cpuBars := int(stat.CpuUse * barCols / stat.Info.Resources.CPUs) - cpuBar := strings.Repeat("|", cpuBars) + strings.Repeat(" ", int(barCols)-cpuBars) + cpuBar := strings.Repeat("|", cpuBars) + if int(barCols)-cpuBars >= 0 { + cpuBar = cpuBar + strings.Repeat(" ", int(barCols)-cpuBars) + } fmt.Printf("\tCPU: [%s] %d/%d core(s) in use\n", color.GreenString(cpuBar), stat.CpuUse, stat.Info.Resources.CPUs) From 1f7d584517403567a2f26e10546e6c7d5fd036d4 Mon Sep 17 00:00:00 2001 From: Aayush Rajasekaran Date: Thu, 29 Jul 2021 14:46:19 -0400 Subject: [PATCH 2/2] Update cmd/lotus-miner/sealing.go --- cmd/lotus-miner/sealing.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/lotus-miner/sealing.go b/cmd/lotus-miner/sealing.go index e38d2de0f..75f02845c 100644 --- a/cmd/lotus-miner/sealing.go +++ b/cmd/lotus-miner/sealing.go @@ -93,7 +93,7 @@ var sealingWorkersCmd = &cli.Command{ cpuBars := int(stat.CpuUse * barCols / stat.Info.Resources.CPUs) cpuBar := strings.Repeat("|", cpuBars) if int(barCols)-cpuBars >= 0 { - cpuBar = cpuBar + strings.Repeat(" ", int(barCols)-cpuBars) + cpuBar += strings.Repeat(" ", int(barCols)-cpuBars) } fmt.Printf("\tCPU: [%s] %d/%d core(s) in use\n",