Skip to content

Commit

Permalink
feat: Breaking changes are introduced by '-b' flag
Browse files Browse the repository at this point in the history
  • Loading branch information
HRemonen committed Sep 9, 2023
1 parent cc9258e commit 74019b1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions cmd/commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ import (

"github.com/spf13/cobra"
)
var isCoAuthored bool

var (
isCoAuthored bool
isBreakingChange bool
)

// CommitCmd represents the commit command.
var commitCmd = &cobra.Command{
Expand Down Expand Up @@ -86,15 +90,6 @@ var commitCmd = &cobra.Command{
}
}

isBreakingChange, err := commit.PromptForBool(prompt.Prompt{
Label: "Is this a breaking change?",
Validate: validators.ValidateStringYesNo,
})
if err != nil {
fmt.Println("Prompt failed:", err)
os.Exit(1)
}

var breakingChangeDescription string
if isBreakingChange {
breakingChangeDescription, err = commit.PromptForString(prompt.Prompt{
Expand Down Expand Up @@ -128,6 +123,7 @@ var commitCmd = &cobra.Command{

func init() {
rootCmd.AddCommand(commitCmd)

commitCmd.Flags().BoolVarP(&isCoAuthored, "isCoAuthored", "a", false, "Enable co-authoring")
commitCmd.Flags().BoolVarP(&isBreakingChange, "isBreakingChange", "b", false, "Commit is introducing a breaking change")
}
Binary file modified commitsense
Binary file not shown.

0 comments on commit 74019b1

Please sign in to comment.