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:
@@ -10,14 +10,24 @@ import (
|
||||
netcontext "golang.org/x/net/context"
|
||||
)
|
||||
|
||||
var checkpointSubCmds = []cli.Command{
|
||||
listCheckpointCommand,
|
||||
createCheckpointCommand,
|
||||
deleteCheckpointCommand,
|
||||
}
|
||||
|
||||
var checkpointCommand = cli.Command{
|
||||
Name: "checkpoints",
|
||||
Usage: "list all checkpoints",
|
||||
Subcommands: []cli.Command{
|
||||
listCheckpointCommand,
|
||||
createCheckpointCommand,
|
||||
deleteCheckpointCommand,
|
||||
},
|
||||
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,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user