forked from toolshed/abra
refactor: moving logging to command functions
easier to unit test our util commands like this
This commit is contained in:
@ -56,7 +56,10 @@ var appListCommand = &cli.Command{
|
||||
// FIXME: Needs to use flags
|
||||
// TODO: Sorting of output to make servers in alphabetical
|
||||
// Looks like sorting a 2d slice of strings might be messy though
|
||||
apps := config.LoadAppFiles()
|
||||
apps, err := config.LoadAppFiles()
|
||||
if err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
tableCol := []string{"Name", "Type", "Server"}
|
||||
table := createTable(tableCol)
|
||||
for name, appFile := range apps {
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
|
||||
"coopcloud.tech/abra/client"
|
||||
"coopcloud.tech/abra/config"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
@ -18,13 +19,16 @@ var serverListCommand = &cli.Command{
|
||||
dockerContextStore := client.NewDefaultDockerContextStore()
|
||||
contexts, err := dockerContextStore.Store.List()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
tableColumns := []string{"Name", "Connection"}
|
||||
table := createTable(tableColumns)
|
||||
defer table.Render()
|
||||
|
||||
serverNames := config.ReadServerNames()
|
||||
serverNames, err := config.ReadServerNames()
|
||||
if err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
for _, serverName := range serverNames {
|
||||
|
||||
var row []string
|
||||
|
Reference in New Issue
Block a user