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
|
||||
if stats, ok = allStats[app.Server]; !ok {
|
||||
stats = serverStatus{}
|
||||
totalServersCount++
|
||||
if appType == "" {
|
||||
// count server, no filtering
|
||||
totalServersCount++
|
||||
}
|
||||
}
|
||||
|
||||
if app.Type == appType || appType == "" {
|
||||
if appType != "" {
|
||||
// only count server if matches filter
|
||||
totalServersCount++
|
||||
}
|
||||
|
||||
appStats := appStatus{}
|
||||
stats.appCount++
|
||||
totalAppsCount++
|
||||
@ -222,23 +230,25 @@ can take some time.
|
||||
table.Append(tableRow)
|
||||
}
|
||||
|
||||
table.Render()
|
||||
if table.NumLines() > 0 {
|
||||
table.Render()
|
||||
|
||||
if status {
|
||||
fmt.Println(fmt.Sprintf(
|
||||
"server: %s | total apps: %v | versioned: %v | unversioned: %v | latest: %v | upgrade: %v",
|
||||
app.Server,
|
||||
serverStat.appCount,
|
||||
serverStat.versionCount,
|
||||
serverStat.unversionedCount,
|
||||
serverStat.latestCount,
|
||||
serverStat.upgradeCount,
|
||||
))
|
||||
} else {
|
||||
fmt.Println(fmt.Sprintf("server: %s | total apps: %v", app.Server, serverStat.appCount))
|
||||
if status {
|
||||
fmt.Println(fmt.Sprintf(
|
||||
"server: %s | total apps: %v | versioned: %v | unversioned: %v | latest: %v | upgrade: %v",
|
||||
app.Server,
|
||||
serverStat.appCount,
|
||||
serverStat.versionCount,
|
||||
serverStat.unversionedCount,
|
||||
serverStat.latestCount,
|
||||
serverStat.upgradeCount,
|
||||
))
|
||||
} else {
|
||||
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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user