feat: add recipe versions command
This commit is contained in:
parent
dfc91a86a1
commit
6eee02d90a
2
TODO.md
2
TODO.md
@ -33,7 +33,7 @@ Disclaimer!: List is WIP
|
|||||||
- [x] `ls`
|
- [x] `ls`
|
||||||
- [ ] `create`
|
- [ ] `create`
|
||||||
- [ ] `release`
|
- [ ] `release`
|
||||||
- [ ] `versions`
|
- [x] `versions`
|
||||||
- [ ] `abra upgrade`
|
- [ ] `abra upgrade`
|
||||||
- [x] `version`
|
- [x] `version`
|
||||||
- [ ] `doctor`
|
- [ ] `doctor`
|
||||||
|
@ -174,10 +174,46 @@ var recipeListCommand = &cli.Command{
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var recipeVersionCommand = &cli.Command{
|
||||||
|
Name: "versions",
|
||||||
|
Usage: "List available versions for <recipe>",
|
||||||
|
ArgsUsage: "<recipe>",
|
||||||
|
Action: func(c *cli.Context) error {
|
||||||
|
recipe := c.Args().First()
|
||||||
|
if recipe == "" {
|
||||||
|
cli.ShowSubcommandHelp(c)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
apps, err := ReadApps()
|
||||||
|
if err != nil {
|
||||||
|
logrus.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if app, ok := apps[recipe]; ok {
|
||||||
|
tableCol := []string{"Version", "Service", "Image", "Digest"}
|
||||||
|
table := createTable(tableCol)
|
||||||
|
for version := range app.Versions {
|
||||||
|
for service := range app.Versions[version] {
|
||||||
|
meta := app.Versions[version][service]
|
||||||
|
table.Append([]string{version, service, meta.Image, meta.Digest})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
table.SetAutoMergeCells(true)
|
||||||
|
table.Render()
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
logrus.Fatalf("'%s' recipe doesn't exist?", recipe)
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
var RecipeCommand = &cli.Command{
|
var RecipeCommand = &cli.Command{
|
||||||
Name: "recipe",
|
Name: "recipe",
|
||||||
HideHelp: true,
|
HideHelp: true,
|
||||||
Subcommands: []*cli.Command{
|
Subcommands: []*cli.Command{
|
||||||
recipeListCommand,
|
recipeListCommand,
|
||||||
|
recipeVersionCommand,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user