Improve formatting of workers CLI

This commit is contained in:
Aayush Rajasekaran 2021-07-29 11:46:42 -04:00
parent 83a4d7dc1c
commit 28e3c8bd3f

View File

@ -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)