AndreasAugustin / go-gitmoji-cli

:octocat: A conventional gitmoji commit interactive command line tool for using emojis on conventional commits. :rocket:
https://gitmoji.dev/
MIT License
8 stars 0 forks source link

[Bug]: calling some cmds do not list the help when subcommands are available #39

Closed AndreasAugustin closed 1 year ago

AndreasAugustin commented 1 year ago

Is there an existing issue for this?

Describe the bug

Some subcommands have subcommands. Currently when calling the parent subcommand one would expect to get the help with a list of available subcommands. But you get nothing. Example:

☁  ~  go-gitmoji-cli list -d      
INFO[0000] Debug logs enabled                           
DEBU[0000] list called                                  
☁  ~  

Expected Behavior

you should get the help command for the subcommand.

Current Behavior

you get nothing

Steps To Reproduce

☁  ~  go-gitmoji-cli list -d      
INFO[0000] Debug logs enabled                           
DEBU[0000] list called                                  
☁  ~  

Possible Solution

Remove the empty run cmd within the related subcommands

var ListCmd = &cobra.Command{
    Use:   "list",
    Short: "List all the available gitmojis",
    Long:  fmt.Sprintf(`The list is queried from the api %s.`, pkg.DefaultGitmojiApiUrl),
    Run: func(cmd *cobra.Command, args []string) {
        log.Debug("list called")
    },
}

Additional Information/Context

No response

go-gitmoji-cli Version

v0.2.6-alpha