From 327573a61efbe49aa1a9383b82df0678ee914cc6 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Mon, 14 Dec 2015 16:06:27 -0800 Subject: [PATCH] Make stats command be subcommand This makes the stats command be a sub command of container. It also makes the id provided via the first arg instead of a flag. Signed-off-by: Michael Crosby --- ctr/container.go | 15 +++++---------- ctr/main.go | 1 - 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/ctr/container.go b/ctr/container.go index 7125a71..900e707 100644 --- a/ctr/container.go +++ b/ctr/container.go @@ -28,10 +28,11 @@ var ContainersCommand = cli.Command{ Name: "containers", Usage: "interact with running containers", Subcommands: []cli.Command{ - StartCommand, - ListCommand, - KillCommand, ExecCommand, + KillCommand, + ListCommand, + StartCommand, + StatsCommand, }, Action: listContainers, } @@ -234,15 +235,9 @@ var ExecCommand = cli.Command{ var StatsCommand = cli.Command{ Name: "stats", Usage: "get stats for running container", - Flags: []cli.Flag{ - cli.StringFlag{ - Name: "id", - Usage: "container id", - }, - }, Action: func(context *cli.Context) { req := &types.StatsRequest{ - Id: context.String("id"), + Id: context.Args().First(), } c := getClient() stream, err := c.GetStats(netcontext.Background(), req) diff --git a/ctr/main.go b/ctr/main.go index 8d27baf..632f168 100644 --- a/ctr/main.go +++ b/ctr/main.go @@ -37,7 +37,6 @@ func main() { CheckpointCommand, ContainersCommand, EventsCommand, - StatsCommand, } app.Before = func(context *cli.Context) error { if context.GlobalBool("debug") {