refactor: moved all fatal errors to logrus

This will allow us to test commands that would normally exit
This commit is contained in:
2021-07-21 09:04:34 +01:00
parent 2158dc851c
commit 29971c36a0
4 changed files with 12 additions and 10 deletions

View File

@ -101,7 +101,7 @@ var appPsCommand = &cli.Command{
cl := client.NewClientWithContext(Context)
tasks, err := cl.TaskList(ctx, types.TaskListOptions{})
if err != nil {
panic(err)
logrus.Fatal(err)
}
for _, task := range tasks {
resolver := idresolver.New(cl, false)
@ -113,7 +113,7 @@ var appPsCommand = &cli.Command{
}
containers, err := cl.ContainerList(ctx, types.ContainerListOptions{})
if err != nil {
panic(err)
logrus.Fatal(err)
}
table := createTable([]string{"ID", "Image", "Command", "Created", "Status", "Ports", "Names"})
var conTable [][]string
@ -166,7 +166,7 @@ var appSecretCommand = &cli.Command{
passgen.WordListDefault,
)
if err != nil {
panic(err)
logrus.Fatal(err)
}
for _, password := range passwords {