hertz_scaffold/cmd/update.go
2024-08-09 14:57:41 +08:00

32 lines
552 B
Go

package cmd
import (
"fmt"
"github.com/spf13/cobra"
"log"
"os"
)
var updateCmd = &cobra.Command{
Use: "update",
Short: "更新项目",
Long: `Update the current project`,
Run: func(cmd *cobra.Command, args []string) {
handleUpdateCommand(args)
},
}
func init() {
initFlags(updateCmd)
}
func handleUpdateCommand(args []string) {
err := handleRemoteTemplate(template, branch, project)
if err != nil {
log.Printf("Error update project: %s\n", err)
os.Exit(1)
}
fmt.Printf("Project %s update successfully!\n", project)
return
}