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:
parent
daa13e48b1
commit
327573a61e
2 changed files with 5 additions and 11 deletions
|
@ -28,10 +28,11 @@ var ContainersCommand = cli.Command{
|
||||||
Name: "containers",
|
Name: "containers",
|
||||||
Usage: "interact with running containers",
|
Usage: "interact with running containers",
|
||||||
Subcommands: []cli.Command{
|
Subcommands: []cli.Command{
|
||||||
StartCommand,
|
|
||||||
ListCommand,
|
|
||||||
KillCommand,
|
|
||||||
ExecCommand,
|
ExecCommand,
|
||||||
|
KillCommand,
|
||||||
|
ListCommand,
|
||||||
|
StartCommand,
|
||||||
|
StatsCommand,
|
||||||
},
|
},
|
||||||
Action: listContainers,
|
Action: listContainers,
|
||||||
}
|
}
|
||||||
|
@ -234,15 +235,9 @@ var ExecCommand = cli.Command{
|
||||||
var StatsCommand = cli.Command{
|
var StatsCommand = cli.Command{
|
||||||
Name: "stats",
|
Name: "stats",
|
||||||
Usage: "get stats for running container",
|
Usage: "get stats for running container",
|
||||||
Flags: []cli.Flag{
|
|
||||||
cli.StringFlag{
|
|
||||||
Name: "id",
|
|
||||||
Usage: "container id",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Action: func(context *cli.Context) {
|
Action: func(context *cli.Context) {
|
||||||
req := &types.StatsRequest{
|
req := &types.StatsRequest{
|
||||||
Id: context.String("id"),
|
Id: context.Args().First(),
|
||||||
}
|
}
|
||||||
c := getClient()
|
c := getClient()
|
||||||
stream, err := c.GetStats(netcontext.Background(), req)
|
stream, err := c.GetStats(netcontext.Background(), req)
|
||||||
|
|
|
@ -37,7 +37,6 @@ func main() {
|
||||||
CheckpointCommand,
|
CheckpointCommand,
|
||||||
ContainersCommand,
|
ContainersCommand,
|
||||||
EventsCommand,
|
EventsCommand,
|
||||||
StatsCommand,
|
|
||||||
}
|
}
|
||||||
app.Before = func(context *cli.Context) error {
|
app.Before = func(context *cli.Context) error {
|
||||||
if context.GlobalBool("debug") {
|
if context.GlobalBool("debug") {
|
||||||
|
|
Loading…
Reference in a new issue