Merge pull request #207 from WeiZhang555/provide-help
Provide more useful help information for ctr
This commit is contained in:
commit
e49fcf514e
3 changed files with 44 additions and 23 deletions
|
@ -14,7 +14,7 @@ The included `ctr` command-line tool allows you interact with the containerd dae
|
|||
$ sudo ctr containers start redis /containers/redis
|
||||
$ sudo ctr containers list
|
||||
ID PATH STATUS PROCESSES
|
||||
1 /containers/redis running 14063
|
||||
redis /containers/redis running 14063
|
||||
```
|
||||
|
||||
`/containers/redis` is the path to an OCI bundle. [See the docs for more information.](docs/bundle.md)
|
||||
|
|
|
@ -10,14 +10,24 @@ import (
|
|||
netcontext "golang.org/x/net/context"
|
||||
)
|
||||
|
||||
var checkpointCommand = cli.Command{
|
||||
Name: "checkpoints",
|
||||
Usage: "list all checkpoints",
|
||||
Subcommands: []cli.Command{
|
||||
var checkpointSubCmds = []cli.Command{
|
||||
listCheckpointCommand,
|
||||
createCheckpointCommand,
|
||||
deleteCheckpointCommand,
|
||||
},
|
||||
}
|
||||
|
||||
var checkpointCommand = cli.Command{
|
||||
Name: "checkpoints",
|
||||
Usage: "list all checkpoints",
|
||||
ArgsUsage: "COMMAND [arguments...]",
|
||||
Subcommands: checkpointSubCmds,
|
||||
Description: func() string {
|
||||
desc := "\n COMMAND:\n"
|
||||
for _, command := range checkpointSubCmds {
|
||||
desc += fmt.Sprintf(" %-10.10s%s\n", command.Name, command.Usage)
|
||||
}
|
||||
return desc
|
||||
}(),
|
||||
Action: listCheckpoints,
|
||||
}
|
||||
|
||||
|
|
|
@ -41,10 +41,7 @@ func getClient(ctx *cli.Context) types.APIClient {
|
|||
return types.NewAPIClient(conn)
|
||||
}
|
||||
|
||||
var containersCommand = cli.Command{
|
||||
Name: "containers",
|
||||
Usage: "interact with running containers",
|
||||
Subcommands: []cli.Command{
|
||||
var contSubCmds = []cli.Command{
|
||||
execCommand,
|
||||
killCommand,
|
||||
listCommand,
|
||||
|
@ -54,7 +51,20 @@ var containersCommand = cli.Command{
|
|||
statsCommand,
|
||||
watchCommand,
|
||||
updateCommand,
|
||||
},
|
||||
}
|
||||
|
||||
var containersCommand = cli.Command{
|
||||
Name: "containers",
|
||||
Usage: "interact with running containers",
|
||||
ArgsUsage: "COMMAND [arguments...]",
|
||||
Subcommands: contSubCmds,
|
||||
Description: func() string {
|
||||
desc := "\n COMMAND:\n"
|
||||
for _, command := range contSubCmds {
|
||||
desc += fmt.Sprintf(" %-10.10s%s\n", command.Name, command.Usage)
|
||||
}
|
||||
return desc
|
||||
}(),
|
||||
Action: listContainers,
|
||||
}
|
||||
|
||||
|
@ -109,6 +119,7 @@ func listContainers(context *cli.Context) {
|
|||
var startCommand = cli.Command{
|
||||
Name: "start",
|
||||
Usage: "start a container",
|
||||
ArgsUsage: "ID BundlePath",
|
||||
Flags: []cli.Flag{
|
||||
cli.StringFlag{
|
||||
Name: "checkpoint,c",
|
||||
|
|
Loading…
Reference in a new issue