hertz_scaffold/cmd/cmd.go

41 lines
673 B
Go
Raw Permalink Normal View History

2024-08-08 21:29:58 +08:00
package cmd
import (
2024-08-08 21:44:39 +08:00
"fmt"
2024-08-08 21:29:58 +08:00
"github.com/spf13/cobra"
"log"
"os"
)
var (
template = "git@golib-ssh.gaore.com:GaoreGo/hertz_demo.git"
project string
2024-08-09 14:57:41 +08:00
branch string
2024-08-08 21:29:58 +08:00
)
var rootCmd = &cobra.Command{
Use: "hertz_scaffold",
Short: "hertz框架脚手架",
Long: `以golib.gaore.com/GaoreGo/hertz_demo为模板的脚手架`,
Run: func(cmd *cobra.Command, args []string) {
2024-08-08 21:44:39 +08:00
if len(args) == 0 {
cmd.Help()
} else {
fmt.Println("Invalid command")
}
2024-08-08 21:29:58 +08:00
},
}
// Execute 执行命令
func Execute() {
if err := rootCmd.Execute(); err != nil {
log.Println(err)
os.Exit(1)
}
}
func init() {
rootCmd.AddCommand(createCmd)
rootCmd.AddCommand(updateCmd)
}