Skip to content

Commit

Permalink
Merge pull request opencontainers#1332 from sak0/dev
Browse files Browse the repository at this point in the history
ps: --format value check
  • Loading branch information
hqhq authored Feb 21, 2017
2 parents 3d7cd1f + 08937e9 commit 3293874
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ps.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var psCommand = cli.Command{
Flags: []cli.Flag{
cli.StringFlag{
Name: "format, f",
Value: "",
Value: "table",
Usage: `select one of: ` + formatOptions,
},
},
Expand All @@ -38,8 +38,12 @@ var psCommand = cli.Command{
return err
}

if context.String("format") == "json" {
switch context.String("format") {
case "table":
case "json":
return json.NewEncoder(os.Stdout).Encode(pids)
default:
return fmt.Errorf("invalid format option")
}

// [1:] is to remove command name, ex:
Expand Down

0 comments on commit 3293874

Please sign in to comment.