Add Help Command to Agent WDD CLI

- Implemented a new 'help' command in the root command
- Configured the help command to use the default usage template
- Integrated the help command into the root command's available subcommands
This commit is contained in:
zeaslity
2025-02-27 14:26:07 +08:00
parent 72bc56b5e5
commit 7a703dccc4

View File

@@ -111,6 +111,18 @@ func Execute() {
}
addDownloadSubcommands(downloadCmd)
helpCmd := &cobra.Command{
Use: "help",
Short: "帮助信息",
Run: func(cmd *cobra.Command, args []string) {
// 在你的命令执行函数中
cmd.Root().SetHelpFunc(func(c *cobra.Command, s []string) {
// 直接使用默认帮助模板
c.Usage()
})
},
}
// 添加所有根命令
rootCmd.AddCommand(
baseCmd,
@@ -123,6 +135,7 @@ func Execute() {
versionCmd,
configCmd,
downloadCmd,
helpCmd,
)
if err := rootCmd.Execute(); err != nil {