forked from toolshed/abra
feat: add x-platform progress bars for long loads
Closes coop-cloud/organising#150.
This commit is contained in:
@ -5,6 +5,7 @@ import (
|
||||
"io/ioutil"
|
||||
"path"
|
||||
|
||||
"coopcloud.tech/abra/cli/formatter"
|
||||
"coopcloud.tech/abra/pkg/catalogue"
|
||||
"coopcloud.tech/abra/pkg/config"
|
||||
"coopcloud.tech/abra/pkg/git"
|
||||
@ -59,15 +60,18 @@ var catalogueGenerateCommand = &cli.Command{
|
||||
|
||||
logrus.Debugf("ensuring '%v' recipe(s) are locally present and up-to-date", len(repos))
|
||||
|
||||
bar := formatter.CreateProgressbar(len(repos), "retrieving recipes...")
|
||||
ch := make(chan string, len(repos))
|
||||
for _, repoMeta := range repos {
|
||||
go func(rm catalogue.RepoMeta) {
|
||||
if recipeName != "" && recipeName != rm.Name {
|
||||
ch <- rm.Name
|
||||
bar.Add(1)
|
||||
return
|
||||
}
|
||||
if _, exists := CatalogueSkipList[rm.Name]; exists {
|
||||
ch <- rm.Name
|
||||
bar.Add(1)
|
||||
return
|
||||
}
|
||||
|
||||
@ -82,6 +86,7 @@ var catalogueGenerateCommand = &cli.Command{
|
||||
}
|
||||
|
||||
ch <- rm.Name
|
||||
bar.Add(1)
|
||||
}(repoMeta)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user