diff --git a/cmd/commit.go b/cmd/commit.go index c51196d..978ab25 100644 --- a/cmd/commit.go +++ b/cmd/commit.go @@ -22,6 +22,7 @@ package cmd import ( + e "github.com/kamontat/gitgo/exception" "github.com/kamontat/gitgo/model" "github.com/kamontat/gitgo/util" "github.com/spf13/viper" @@ -46,12 +47,14 @@ var commitCmd = &cobra.Command{ keyQuestion, validates := util.GenerateQuestionViaTypeConfig("Please enter commit type", config.Key, listYAML) if keyQuestion != nil { - survey.AskOne(keyQuestion, &commitMessage.Type, validates...) + err := survey.AskOne(keyQuestion, &commitMessage.Type, validates...) + e.Error(e.IsCommit, err).ShowMessage().Exit() } scopeQuestion, validates := util.GenerateQuestionViaTypeConfig("Please enter commit scope", config.Scope, listYAML) if scopeQuestion != nil { - survey.AskOne(scopeQuestion, &commitMessage.Scope, validates...) + err := survey.AskOne(scopeQuestion, &commitMessage.Scope, validates...) + e.Error(e.IsCommit, err).ShowMessage().Exit() } titleQuestion, validates := util.GenerateQuestionViaTypeConfig("Please enter commit title", config.Title, listYAML) @@ -61,7 +64,8 @@ var commitCmd = &cobra.Command{ messageQuestion, validates := util.GenerateQuestionViaTypeConfig("Please enter commit message", config.Message, listYAML) if messageQuestion != nil { - survey.AskOne(messageQuestion, &commitMessage.Message, validates...) + err := survey.AskOne(messageQuestion, &commitMessage.Message, validates...) + e.Error(e.IsCommit, err).ShowMessage().Exit() } commit := repo.GetCommit() diff --git a/cmd/root.go b/cmd/root.go index fd104fb..0e76656 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -42,7 +42,7 @@ var repo *model.Repo var debug bool var verbose bool -var version = "4.0.0-beta.2" +var version = "4.0.0-beta.3" // rootCmd represents the base command when called without any subcommands. var rootCmd = &cobra.Command{ @@ -55,6 +55,7 @@ This command create by golang with cobra cli. Motivation by gitmoji and GitFlow, Force everyone to create the exect same templates of commit and branch +4.0.0-beta.3 - fix commit always call git commit even prompt was exited 4.0.0-beta.2 - refactor how configuration will be loaded and add more key to configable 4.0.0-beta.1 - remove global configuration settings;