Update ctr containers and tasks command

This moves container and tasks commands under the containers and tasks
top level commands.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2017-08-07 11:08:50 -04:00
parent b20fd92a13
commit 00288bcb58
15 changed files with 188 additions and 168 deletions

33
cmd/ctr/task_delete.go Normal file
View File

@@ -0,0 +1,33 @@
package main
import "github.com/urfave/cli"
var taskDeleteCommand = cli.Command{
Name: "delete",
Usage: "delete a task",
ArgsUsage: "CONTAINER",
Action: func(context *cli.Context) error {
ctx, cancel := appContext(context)
defer cancel()
client, err := newClient(context)
if err != nil {
return err
}
container, err := client.LoadContainer(ctx, context.Args().First())
if err != nil {
return err
}
task, err := container.Task(ctx, nil)
if err != nil {
return err
}
status, err := task.Delete(ctx)
if err != nil {
return err
}
if status != 0 {
return cli.NewExitError("", int(status))
}
return nil
},
}