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 }