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{}
|
||||||
totalServersCount++
|
if appType == "" {
|
||||||
|
// count server, no filtering
|
||||||
|
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,23 +230,25 @@ can take some time.
|
|||||||
table.Append(tableRow)
|
table.Append(tableRow)
|
||||||
}
|
}
|
||||||
|
|
||||||
table.Render()
|
if table.NumLines() > 0 {
|
||||||
|
table.Render()
|
||||||
|
|
||||||
if status {
|
if status {
|
||||||
fmt.Println(fmt.Sprintf(
|
fmt.Println(fmt.Sprintf(
|
||||||
"server: %s | total apps: %v | versioned: %v | unversioned: %v | latest: %v | upgrade: %v",
|
"server: %s | total apps: %v | versioned: %v | unversioned: %v | latest: %v | upgrade: %v",
|
||||||
app.Server,
|
app.Server,
|
||||||
serverStat.appCount,
|
serverStat.appCount,
|
||||||
serverStat.versionCount,
|
serverStat.versionCount,
|
||||||
serverStat.unversionedCount,
|
serverStat.unversionedCount,
|
||||||
serverStat.latestCount,
|
serverStat.latestCount,
|
||||||
serverStat.upgradeCount,
|
serverStat.upgradeCount,
|
||||||
))
|
))
|
||||||
} 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