[agent][wdd] - 初始化项目

This commit is contained in:
zeaslity
2025-02-10 15:07:44 +08:00
parent a0811d62e7
commit b8f0b14852
12 changed files with 455 additions and 0 deletions

View File

@@ -58,6 +58,97 @@ func initConfig() {
func Execute() {
// 1. base命令
baseCmd := &cobra.Command{
Use: "base",
Short: "服务器基础操作",
}
addBaseSubcommands(baseCmd)
// 2. zsh命令
zshCmd := &cobra.Command{
Use: "zsh",
Short: "zsh相关的内容",
}
addZshSubcommands(zshCmd)
// 3. proxy命令
proxyCmd := &cobra.Command{
Use: "proxy",
Short: "主机代理相关的内容",
}
addProxySubcommands(proxyCmd)
// 4. acme命令
acmeCmd := &cobra.Command{
Use: "acme",
Short: "acme相关的内容",
}
addAcmeSubcommands(acmeCmd)
// 5. wdd命令
wddCmd := &cobra.Command{
Use: "wdd",
Short: "WDD相关操作",
}
addWddSubcommands(wddCmd)
// 6. security命令
securityCmd := &cobra.Command{
Use: "security",
Short: "安全相关操作",
}
// 7. info命令
infoCmd := &cobra.Command{
Use: "info",
Short: "打印主机详细信息",
Run: func(cmd *cobra.Command, args []string) {
// 实现info逻辑
},
}
// 8. version命令
versionCmd := &cobra.Command{
Use: "version",
Short: "打印版本信息",
Run: func(cmd *cobra.Command, args []string) {
// 实现version逻辑
},
}
// 9. config命令
configCmd := &cobra.Command{
Use: "config",
Short: "配置文件管理",
}
addConfigSubcommands(configCmd)
// 10. download命令
downloadCmd := &cobra.Command{
Use: "download",
Short: "文件下载管理",
}
addDownloadSubcommands(downloadCmd)
// 添加所有根命令
rootCmd.AddCommand(
baseCmd,
zshCmd,
proxyCmd,
acmeCmd,
wddCmd,
securityCmd,
infoCmd,
versionCmd,
configCmd,
downloadCmd,
)
if err := rootCmd.Execute(); err != nil {
fmt.Println(err)
}
if err := rootCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(1)