Provide more useful help information for ctr
`ctr containers/checkpoints` contains lots of important subcommands, but now help command can't show subcommands. Adding subcommands to help information will avoid user from digging into the code for getting necessary command list. Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
This commit is contained in:
@@ -41,20 +41,30 @@ func getClient(ctx *cli.Context) types.APIClient {
|
||||
return types.NewAPIClient(conn)
|
||||
}
|
||||
|
||||
var contSubCmds = []cli.Command{
|
||||
execCommand,
|
||||
killCommand,
|
||||
listCommand,
|
||||
pauseCommand,
|
||||
resumeCommand,
|
||||
startCommand,
|
||||
statsCommand,
|
||||
watchCommand,
|
||||
updateCommand,
|
||||
}
|
||||
|
||||
var containersCommand = cli.Command{
|
||||
Name: "containers",
|
||||
Usage: "interact with running containers",
|
||||
Subcommands: []cli.Command{
|
||||
execCommand,
|
||||
killCommand,
|
||||
listCommand,
|
||||
pauseCommand,
|
||||
resumeCommand,
|
||||
startCommand,
|
||||
statsCommand,
|
||||
watchCommand,
|
||||
updateCommand,
|
||||
},
|
||||
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,
|
||||
}
|
||||
|
||||
@@ -107,8 +117,9 @@ func listContainers(context *cli.Context) {
|
||||
}
|
||||
|
||||
var startCommand = cli.Command{
|
||||
Name: "start",
|
||||
Usage: "start a container",
|
||||
Name: "start",
|
||||
Usage: "start a container",
|
||||
ArgsUsage: "ID BundlePath",
|
||||
Flags: []cli.Flag{
|
||||
cli.StringFlag{
|
||||
Name: "checkpoint,c",
|
||||
|
Reference in New Issue
Block a user