Merge pull request #751 from mrunalp/list_quiet
Add -q to list to print only container IDs
This commit is contained in:
commit
616ad448e1
11
list.go
11
list.go
|
@ -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)
|
||||
|
|
|
@ -12,3 +12,4 @@ in json format:
|
|||
|
||||
# OPTIONS
|
||||
--format, -f select one of: table or json.
|
||||
--quiet, -q display only container IDs
|
||||
|
|
Loading…
Reference in New Issue