forked from toolshed/abra
		
	fix: disable progress bar with machine-readable output
This commit is contained in:
		@ -104,7 +104,7 @@ can take some time.
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			statuses, err = config.GetAppStatuses(appFiles)
 | 
			
		||||
			statuses, err = config.GetAppStatuses(appFiles, internal.MachineReadable)
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				logrus.Fatal(err)
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
@ -7,6 +7,8 @@ import (
 | 
			
		||||
	"path"
 | 
			
		||||
	"strings"
 | 
			
		||||
 | 
			
		||||
	"github.com/schollz/progressbar/v3"
 | 
			
		||||
 | 
			
		||||
	"coopcloud.tech/abra/pkg/formatter"
 | 
			
		||||
	"coopcloud.tech/abra/pkg/upstream/convert"
 | 
			
		||||
	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
 | 
			
		||||
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)
 | 
			
		||||
 | 
			
		||||
	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))
 | 
			
		||||
	for server := range servers {
 | 
			
		||||
		go func(s string) {
 | 
			
		||||
			ch <- stack.GetAllDeployedServices(s)
 | 
			
		||||
			if !MachineReadable {
 | 
			
		||||
				bar.Add(1)
 | 
			
		||||
			}
 | 
			
		||||
		}(server)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user