Skip to content

Commit e6c76c0

Browse files
committed
fix(cmd): correct help command usage and add execution logic
- Change the help command usage from "no-help" to "help". - Add logic to execute help command when no arguments are provided. [Generated by Kommit]
1 parent 6d10b7e commit e6c76c0

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

cmd/root.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,18 @@ var Debug bool
191191

192192
func init() {
193193
rootCmd.SetHelpCommand(&cobra.Command{
194-
Use: "no-help",
194+
Use: "help",
195+
Short: "🔍 Free therapy session for confused commands",
195196
Hidden: true,
197+
Run: func(cmd *cobra.Command, args []string) {
198+
if len(args) == 0 {
199+
rootCmd.Help()
200+
os.Exit(0)
201+
}
202+
},
196203
})
197204

205+
// TODO: add a man page
198206
rootCmd.PersistentFlags().BoolP("help", "h", false,
199207
"Schedule an emergency therapy session (show help)")
200208

0 commit comments

Comments
 (0)