mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-10 21:53:57 +08:00
Add -q to list to print only container IDs
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user