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