Merge pull request #639 from rajasec/list-error

Changing from logrus to fatal in list
This commit is contained in:
Mrunal Patel 2016-03-13 21:24:45 -07:00
commit b6be1e93fc
1 changed files with 5 additions and 6 deletions

11
list.go
View File

@ -13,7 +13,6 @@ import (
"encoding/json" "encoding/json"
"github.com/Sirupsen/logrus"
"github.com/codegangsta/cli" "github.com/codegangsta/cli"
) )
@ -52,7 +51,7 @@ in json format:
Action: func(context *cli.Context) { Action: func(context *cli.Context) {
s, err := getContainers(context) s, err := getContainers(context)
if err != nil { if err != nil {
logrus.Fatal(err) fatal(err)
} }
switch context.String("format") { switch context.String("format") {
@ -68,17 +67,17 @@ in json format:
item.Created.Format(time.RFC3339Nano)) item.Created.Format(time.RFC3339Nano))
} }
if err := w.Flush(); err != nil { if err := w.Flush(); err != nil {
logrus.Fatal(err) fatal(err)
} }
case "json": case "json":
data, err := json.Marshal(s) data, err := json.Marshal(s)
if err != nil { if err != nil {
logrus.Fatal(err) fatal(err)
} }
os.Stdout.Write(data) os.Stdout.Write(data)
default: default:
logrus.Fatal("invalid format option") fatalf("invalid format option")
} }
}, },
} }
@ -95,7 +94,7 @@ func getContainers(context *cli.Context) ([]containerState, error) {
} }
list, err := ioutil.ReadDir(absRoot) list, err := ioutil.ReadDir(absRoot)
if err != nil { if err != nil {
logrus.Fatal(err) fatal(err)
} }
var s []containerState var s []containerState