Skip to content

Commit 4ae0b04

Browse files
committed
🐛 fix(cmd): fix issue in root
1 parent 1d0469c commit 4ae0b04

1 file changed

Lines changed: 47 additions & 5 deletions

File tree

cmd/root.go

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ var rootCmd = &cobra.Command{
4949
Long: `Commitz helps you create well-formatted conventional commits.
5050
It can auto-detect commit types or guide you through an interactive process.`,
5151
Run: func(cmd *cobra.Command, args []string) {
52+
if interactive {
53+
runInteractive()
54+
return
55+
}
56+
5257
generateCommitMessage()
5358
},
5459
}
@@ -62,11 +67,48 @@ func Execute() {
6267
}
6368

6469
func init() {
65-
rootCmd.PersistentFlags().StringVarP(&commitType, "type", "t", "", "Commit type (feat, fix, docs, etc.)")
66-
rootCmd.PersistentFlags().StringVarP(&commitScope, "scope", "s", "", "Commit scope")
67-
rootCmd.PersistentFlags().BoolVarP(&useEmoji, "emoji", "e", false, "Add emoji to commit message")
68-
rootCmd.PersistentFlags().BoolVarP(&dryRun, "dry-run", "d", false, "Preview commit message without committing")
69-
rootCmd.PersistentFlags().BoolVarP(&interactive, "interactive", "i", false, "Interactive mode with prompts")
70+
rootCmd.PersistentFlags().StringVarP(
71+
&commitType,
72+
"type",
73+
"t",
74+
"",
75+
"Commit type (feat, fix, docs, refactor, test, chore)",
76+
)
77+
78+
rootCmd.PersistentFlags().StringVarP(
79+
&commitScope,
80+
"scope",
81+
"s",
82+
"",
83+
"Commit scope",
84+
)
85+
86+
rootCmd.PersistentFlags().BoolVarP(
87+
&useEmoji,
88+
"emoji",
89+
"e",
90+
false,
91+
"Add emoji to commit message",
92+
)
93+
94+
rootCmd.PersistentFlags().BoolVarP(
95+
&dryRun,
96+
"dry-run",
97+
"d",
98+
false,
99+
"Preview commit message without committing",
100+
)
101+
102+
rootCmd.PersistentFlags().BoolVarP(
103+
&interactive,
104+
"interactive",
105+
"i",
106+
false,
107+
"Enable interactive commit mode",
108+
)
109+
}
110+
func runInteractive() {
111+
println("Interactive mode is not implemented yet.")
70112
}
71113

72114
func generateCommitMessage() {

0 commit comments

Comments
 (0)