Merge pull request #6942 from filecoin-project/asr/nit

Improve formatting of workers CLI
This commit is contained in:
Aayush Rajasekaran 2021-07-29 15:09:06 -04:00 committed by GitHub
commit e5fb4a6c04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -91,7 +91,10 @@ var sealingWorkersCmd = &cli.Command{
var barCols = uint64(64) var barCols = uint64(64)
cpuBars := int(stat.CpuUse * barCols / stat.Info.Resources.CPUs) 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 += strings.Repeat(" ", int(barCols)-cpuBars)
}
fmt.Printf("\tCPU: [%s] %d/%d core(s) in use\n", fmt.Printf("\tCPU: [%s] %d/%d core(s) in use\n",
color.GreenString(cpuBar), stat.CpuUse, stat.Info.Resources.CPUs) color.GreenString(cpuBar), stat.CpuUse, stat.Info.Resources.CPUs)