41 lines
673 B
Go
41 lines
673 B
Go
package cmd
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/spf13/cobra"
|
|
"log"
|
|
"os"
|
|
)
|
|
|
|
var (
|
|
template = "https://golib.gaore.com/GaoreGo/hertz_demo.git"
|
|
project string
|
|
branch string
|
|
)
|
|
|
|
var rootCmd = &cobra.Command{
|
|
Use: "hertz_scaffold",
|
|
Short: "hertz框架脚手架",
|
|
Long: `以golib.gaore.com/GaoreGo/hertz_demo为模板的脚手架`,
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
if len(args) == 0 {
|
|
cmd.Help()
|
|
} else {
|
|
fmt.Println("Invalid command")
|
|
}
|
|
},
|
|
}
|
|
|
|
// Execute 执行命令
|
|
func Execute() {
|
|
if err := rootCmd.Execute(); err != nil {
|
|
log.Println(err)
|
|
os.Exit(1)
|
|
}
|
|
}
|
|
|
|
func init() {
|
|
rootCmd.AddCommand(createCmd)
|
|
rootCmd.AddCommand(updateCmd)
|
|
}
|