重构架构
This commit is contained in:
41
internal/cli/soft/install.go
Normal file
41
internal/cli/soft/install.go
Normal file
@@ -0,0 +1,41 @@
|
||||
package soft
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"sunhpc/pkg/logger"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
func NewSoftInstallCmd() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "install [software]",
|
||||
Short: "安装软件",
|
||||
Long: "在集群节点上安装指定软件",
|
||||
Args: cobra.MinimumNArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
||||
software := args[0]
|
||||
|
||||
logger.Info("开始安装软件", zap.String("software", software))
|
||||
|
||||
// TODO: 实现软件安装逻辑
|
||||
// 1. 检查软件包
|
||||
// 2. 分发到节点
|
||||
// 3. 执行安装
|
||||
|
||||
fmt.Printf("✓ 软件 %s 安装完成\n", software)
|
||||
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
// 添加安装命令的标志
|
||||
cmd.Flags().StringSlice("nodes", []string{}, "目标节点列表")
|
||||
cmd.Flags().String("version", "", "软件版本")
|
||||
cmd.Flags().Bool("force", false, "强制安装")
|
||||
|
||||
return cmd
|
||||
}
|
||||
18
internal/cli/soft/soft.go
Normal file
18
internal/cli/soft/soft.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package soft
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func NewSoftCmd() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "soft",
|
||||
Short: "软件管理命令",
|
||||
Long: "管理集群软件安装、更新、卸载等操作",
|
||||
}
|
||||
|
||||
// 添加 soft 的子命令
|
||||
cmd.AddCommand(NewSoftInstallCmd())
|
||||
|
||||
return cmd
|
||||
}
|
||||
Reference in New Issue
Block a user