fix: fix filtering by type for output
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
30209de3e2
commit
c900cebc30
@ -124,10 +124,18 @@ can take some time.
|
|||||||
var ok bool
|
var ok bool
|
||||||
if stats, ok = allStats[app.Server]; !ok {
|
if stats, ok = allStats[app.Server]; !ok {
|
||||||
stats = serverStatus{}
|
stats = serverStatus{}
|
||||||
|
if appType == "" {
|
||||||
|
// count server, no filtering
|
||||||
totalServersCount++
|
totalServersCount++
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if app.Type == appType || appType == "" {
|
if app.Type == appType || appType == "" {
|
||||||
|
if appType != "" {
|
||||||
|
// only count server if matches filter
|
||||||
|
totalServersCount++
|
||||||
|
}
|
||||||
|
|
||||||
appStats := appStatus{}
|
appStats := appStatus{}
|
||||||
stats.appCount++
|
stats.appCount++
|
||||||
totalAppsCount++
|
totalAppsCount++
|
||||||
@ -222,6 +230,7 @@ can take some time.
|
|||||||
table.Append(tableRow)
|
table.Append(tableRow)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if table.NumLines() > 0 {
|
||||||
table.Render()
|
table.Render()
|
||||||
|
|
||||||
if status {
|
if status {
|
||||||
@ -237,8 +246,9 @@ can take some time.
|
|||||||
} else {
|
} else {
|
||||||
fmt.Println(fmt.Sprintf("server: %s | total apps: %v", app.Server, serverStat.appCount))
|
fmt.Println(fmt.Sprintf("server: %s | total apps: %v", app.Server, serverStat.appCount))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if len(allStats) > 1 {
|
if len(allStats) > 1 && table.NumLines() > 0 {
|
||||||
fmt.Println() // newline separator for multiple servers
|
fmt.Println() // newline separator for multiple servers
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user