Merge pull request #751 from mrunalp/list_quiet

Add -q to list to print only container IDs
This commit is contained in:
Michael Crosby 2016-04-19 16:16:09 -07:00
commit 616ad448e1
2 changed files with 12 additions and 0 deletions

11
list.go
View File

@ -47,6 +47,10 @@ in json format:
# runc list -f json`,
},
cli.BoolFlag{
Name: "quiet, q",
Usage: "display only container IDs",
},
},
Action: func(context *cli.Context) {
s, err := getContainers(context)
@ -54,6 +58,13 @@ in json format:
fatal(err)
}
if context.Bool("quiet") {
for _, item := range s {
fmt.Println(item.ID)
}
return
}
switch context.String("format") {
case "", "table":
w := tabwriter.NewWriter(os.Stdout, 12, 1, 3, ' ', 0)

View File

@ -12,3 +12,4 @@ in json format:
# OPTIONS
--format, -f select one of: table or json.
--quiet, -q display only container IDs