feat: add x-platform progress bars for long loads

Closes coop-cloud/organising#150.
This commit is contained in:
2021-09-22 07:48:17 +02:00
parent 95a9013658
commit b1147cd136
5 changed files with 47 additions and 10 deletions

View File

@ -9,6 +9,7 @@ import (
"github.com/docker/cli/cli/command/formatter"
"github.com/docker/go-units"
"github.com/olekukonko/tablewriter"
"github.com/schollz/progressbar/v3"
)
func ShortenID(str string) string {
@ -37,3 +38,15 @@ func CreateTable(columns []string) *tablewriter.Table {
table.SetHeader(columns)
return table
}
// CreateProgressbar generates a progress bar
func CreateProgressbar(length int, title string) *progressbar.ProgressBar {
return progressbar.NewOptions(
length,
progressbar.OptionClearOnFinish(),
progressbar.OptionSetPredictTime(false),
progressbar.OptionShowCount(),
progressbar.OptionFullWidth(),
progressbar.OptionSetDescription(title),
)
}