Files
forge/internal/cmd/installcmd/prepare.go
2026-01-13 20:13:29 +08:00

33 lines
706 B
Go

package installcmd
import (
"github.com/spf13/cobra"
"yizhisec.com/hsv2/forge/internal/controller/installer"
)
func Prepare() *cobra.Command {
var (
workdir string
)
_cmd := &cobra.Command{
Use: "prepare",
Short: "Prepare for installation",
Long: "Prepare for installation",
PreRunE: func(cmd *cobra.Command, args []string) error {
i := installer.NewInstaller(workdir)
return i.CheckOK(cmd.Context())
},
RunE: func(cmd *cobra.Command, args []string) error {
_installer := installer.NewInstaller(workdir)
_installer.Prepare(cmd.Context())
return nil
},
}
_cmd.Flags().StringVar(&workdir, "workdir", "/root/hs-installation", "Working directory")
return _cmd
}