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 <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby 2015-12-14 16:06:27 -08:00
parent daa13e48b1
commit 327573a61e
2 changed files with 5 additions and 11 deletions

View file

@ -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)

View file

@ -37,7 +37,6 @@ func main() {
CheckpointCommand,
ContainersCommand,
EventsCommand,
StatsCommand,
}
app.Before = func(context *cli.Context) error {
if context.GlobalBool("debug") {