fix: disable progress bar with machine-readable output
This commit is contained in:
parent
3a0d9f7ed7
commit
b204b289d1
|
@ -104,7 +104,7 @@ can take some time.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
statuses, err = config.GetAppStatuses(appFiles)
|
statuses, err = config.GetAppStatuses(appFiles, internal.MachineReadable)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Fatal(err)
|
logrus.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,8 @@ import (
|
||||||
"path"
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/schollz/progressbar/v3"
|
||||||
|
|
||||||
"coopcloud.tech/abra/pkg/formatter"
|
"coopcloud.tech/abra/pkg/formatter"
|
||||||
"coopcloud.tech/abra/pkg/upstream/convert"
|
"coopcloud.tech/abra/pkg/upstream/convert"
|
||||||
loader "coopcloud.tech/abra/pkg/upstream/stack"
|
loader "coopcloud.tech/abra/pkg/upstream/stack"
|
||||||
|
@ -343,7 +345,7 @@ func SanitiseAppName(name string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetAppStatuses queries servers to check the deployment status of given apps
|
// GetAppStatuses queries servers to check the deployment status of given apps
|
||||||
func GetAppStatuses(appFiles AppFiles) (map[string]map[string]string, error) {
|
func GetAppStatuses(appFiles AppFiles, MachineReadable bool) (map[string]map[string]string, error) {
|
||||||
statuses := make(map[string]map[string]string)
|
statuses := make(map[string]map[string]string)
|
||||||
|
|
||||||
var unique []string
|
var unique []string
|
||||||
|
@ -355,12 +357,18 @@ func GetAppStatuses(appFiles AppFiles) (map[string]map[string]string, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bar := formatter.CreateProgressbar(len(servers), "querying remote servers...")
|
var bar *progressbar.ProgressBar
|
||||||
|
|
||||||
|
if !MachineReadable {
|
||||||
|
bar = formatter.CreateProgressbar(len(servers), "querying remote servers...")
|
||||||
|
}
|
||||||
ch := make(chan stack.StackStatus, len(servers))
|
ch := make(chan stack.StackStatus, len(servers))
|
||||||
for server := range servers {
|
for server := range servers {
|
||||||
go func(s string) {
|
go func(s string) {
|
||||||
ch <- stack.GetAllDeployedServices(s)
|
ch <- stack.GetAllDeployedServices(s)
|
||||||
|
if !MachineReadable {
|
||||||
bar.Add(1)
|
bar.Add(1)
|
||||||
|
}
|
||||||
}(server)
|
}(server)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue