Skip to content

Commit

Permalink
update to time based
Browse files Browse the repository at this point in the history
Signed-off-by: cardyok <[email protected]>
  • Loading branch information
cardyok committed Oct 23, 2024
1 parent cc24ec6 commit d06bf1c
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions cmd/gpud/command/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,14 @@ func cmdStatus(cliContext *cli.Context) error {
if statusWatch {
fmt.Print("\033[2J\033[H")
}
var totalTime int64
var progress int64
for _, status := range packageStatus {
statusSign := warningSign
if status.Status {
statusSign = checkMark
}
progress := fmt.Sprintf("%v%%", status.Progress)
if !status.Installing && !status.IsInstalled {
progress = "Not Started, Waiting for dependencies to finish..."
}
fmt.Printf("%s %v current version: %v target version: %v, status: %v installed: %v progress: %v\n", statusSign, status.Name, status.CurrentVersion, status.TargetVersion, status.Status, status.IsInstalled, progress)
totalTime += status.TotalTime.Milliseconds()
progress += status.TotalTime.Milliseconds() * int64(status.Progress) / 100
}

fmt.Printf("Total progress: %v%%, Estimate time left: %v\n", progress*100/totalTime, time.Duration(totalTime-progress)*time.Millisecond)
if !statusWatch {
break
}
Expand Down

0 comments on commit d06bf1c

Please sign in to comment.