[minor] better console output in client action following

This commit is contained in:
Julien Vehent 2015-03-18 09:17:45 -04:00
Родитель aa7554798a
Коммит b4707bb1f2
1 изменённых файлов: 8 добавлений и 2 удалений

Просмотреть файл

@ -619,7 +619,7 @@ func (cli Client) FollowAction(a mig.Action) (err error) {
status = a.Status
}
if status != a.Status {
fmt.Fprintf(os.Stderr, "status=%s\n", a.Status)
fmt.Fprintf(os.Stderr, "\nstatus=%s", a.Status)
status = a.Status
}
// exit follower mode if status isn't one we follow,
@ -653,7 +653,13 @@ func (cli Client) FollowAction(a mig.Action) (err error) {
dotter++
}
finish:
fmt.Fprintf(os.Stderr, "\n%2.1f%% done in %s\n", completion, time.Now().Sub(a.StartTime).String())
a, _, err = cli.GetAction(a.ID)
if err != nil {
fmt.Fprintf(os.Stderr, "[error] failed to retrieve action counters\n")
} else {
completion = (float64(a.Counters.Done) / float64(a.Counters.Sent)) * 100
fmt.Fprintf(os.Stderr, "- %2.1f%% done in %s\n", completion, time.Now().Sub(a.StartTime).String())
}
a.PrintCounters()
return
}