forked from toolshed/abra
feat: add x-platform progress bars for long loads
Closes coop-cloud/organising#150.
This commit is contained in:
@ -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),
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user