refactor!: type -> recipes

This commit is contained in:
2022-01-25 12:37:13 +01:00
parent 224b8865bf
commit 58e98f490d
15 changed files with 75 additions and 77 deletions

View File

@ -22,12 +22,12 @@ var statusFlag = &cli.BoolFlag{
Destination: &status,
}
var appType string
var typeFlag = &cli.StringFlag{
Name: "type, t",
var appRecipe string
var recipeFlag = &cli.StringFlag{
Name: "recipe, r",
Value: "",
Usage: "Show apps of a specific type",
Destination: &appType,
Usage: "Show apps of a specific recipe",
Destination: &appRecipe,
}
var listAppServer string
@ -73,7 +73,7 @@ can take some time.
internal.DebugFlag,
statusFlag,
listAppServerFlag,
typeFlag,
recipeFlag,
},
Before: internal.SubCommandBefore,
Action: func(c *cli.Context) error {
@ -87,7 +87,7 @@ can take some time.
logrus.Fatal(err)
}
sort.Sort(config.ByServerAndType(apps))
sort.Sort(config.ByServerAndRecipe(apps))
statuses := make(map[string]map[string]string)
var catl recipe.RecipeCatalogue
@ -122,14 +122,14 @@ can take some time.
var ok bool
if stats, ok = allStats[app.Server]; !ok {
stats = serverStatus{}
if appType == "" {
if appRecipe == "" {
// count server, no filtering
totalServersCount++
}
}
if app.Type == appType || appType == "" {
if appType != "" {
if app.Recipe == appRecipe || appRecipe == "" {
if appRecipe != "" {
// only count server if matches filter
totalServersCount++
}
@ -160,7 +160,7 @@ can take some time.
var newUpdates []string
if version != "unknown" {
updates, err := recipe.GetRecipeCatalogueVersions(app.Type, catl)
updates, err := recipe.GetRecipeCatalogueVersions(app.Recipe, catl)
if err != nil {
logrus.Fatal(err)
}
@ -197,7 +197,7 @@ can take some time.
}
appStats.server = app.Server
appStats.recipe = app.Type
appStats.recipe = app.Recipe
appStats.appName = app.Name
appStats.domain = app.Domain