0
0
forked from toolshed/abra

feat: implemented type & servers flags in app ls

This commit is contained in:
2021-07-20 13:00:03 +01:00
parent 635c6d6080
commit 16514b3151
2 changed files with 16 additions and 8 deletions

View File

@ -53,10 +53,10 @@ var appListCommand = &cli.Command{
Aliases: []string{"ls"},
Flags: []cli.Flag{StatusFlag, ServerFlag, TypeFlag},
Action: func(c *cli.Context) error {
// FIXME: Needs to use flags
// FIXME: Needs status flag implementing
// TODO: Sorting of output to make servers in alphabetical
// Looks like sorting a 2d slice of strings might be messy though
apps, err := config.LoadAppFiles()
apps, err := config.LoadAppFiles(Server)
if err != nil {
logrus.Fatal(err)
}
@ -67,8 +67,12 @@ var appListCommand = &cli.Command{
if err != nil {
logrus.Fatal(err.Error())
}
tableRow := []string{name, app.Type, appFile.Server}
table.Append(tableRow)
if app.Type == Type || Type == "" {
// If type flag is set, check for it, if not, Type == ""
tableRow := []string{name, app.Type, appFile.Server}
table.Append(tableRow)
}
}
table.Render()
return nil