🏗️ move make sub-cmd to sub-dir
This commit is contained in:
31
internal/cmd/makecmd/images.go
Normal file
31
internal/cmd/makecmd/images.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package makecmd
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"yizhisec.com/hsv2/forge/internal/controller/maker"
|
||||
"yizhisec.com/hsv2/forge/internal/opt"
|
||||
)
|
||||
|
||||
func Images() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "images",
|
||||
Aliases: []string{"image"},
|
||||
Short: "Build and pull Docker images",
|
||||
Long: `Build and pull all required Docker images for the project.`,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
||||
if err := os.MkdirAll(filepath.Join(opt.Cfg.Make.Dir, "dependency", "image"), 0755); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
mk := maker.NewMaker()
|
||||
|
||||
return mk.Images(cmd.Context())
|
||||
},
|
||||
}
|
||||
|
||||
return cmd
|
||||
}
|
||||
Reference in New Issue
Block a user