refactor: moving logging to command functions

easier to unit test our util commands like this
This commit is contained in:
2021-07-19 12:47:46 +01:00
parent bd9bc530d1
commit cfe2f70151
3 changed files with 42 additions and 25 deletions

View File

@ -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