Skip to content

Commit

Permalink
feat!: updated naming of certain variables and functions
Browse files Browse the repository at this point in the history
BREAKING CHANGE:
  • Loading branch information
HRemonen committed Sep 21, 2024
1 parent 7a2a5ea commit 93a0d6b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions cmd/shorthand.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ var (
breakingChange bool
)

func shorthandCmd(commitType string) *cobra.Command {
cmd := &cobra.Command{
func newShorthandCommand(commitType string) *cobra.Command {
shorthandCmd := &cobra.Command{
Use: commitType + " [message]",
Short: fmt.Sprintf("Create a git commit with type %s", commitType),
Args: cobra.MinimumNArgs(1),
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, args []string) {
stagedFiles, err := commit.GetStagedFiles()
if err != nil {
colorprinter.ColorPrint("error", "Error: %v", err)
Expand All @@ -57,16 +57,16 @@ func shorthandCmd(commitType string) *cobra.Command {
},
}

cmd.Flags().StringVarP(&commitScope, "scope", "s", "", "Commit scope")
cmd.Flags().BoolVarP(&breakingChange, "is-breaking", "b", false, "Commit is introducing a breaking change")
shorthandCmd.Flags().StringVarP(&commitScope, "scope", "s", "", "Commit scope")
shorthandCmd.Flags().BoolVarP(&breakingChange, "is-breaking", "b", false, "Commit is introducing a breaking change")

return cmd
return shorthandCmd
}

func init() {
commitTypes := []string{"build", "ci", "chore", "docs", "feat", "fix", "perf", "refactor", "revert", "style", "test"}

for _, commitType := range commitTypes {
rootCmd.AddCommand(shorthandCmd(commitType))
rootCmd.AddCommand(newShorthandCommand(commitType))
}
}

0 comments on commit 93a0d6b

Please sign in to comment.