urfave / cli

A simple, fast, and fun package for building command line apps in Go
https://cli.urfave.org
MIT License
21.91k stars 1.69k forks source link

Combine behavioral struct fields into sub-struct groupings #1791

Open meatballhat opened 1 year ago

meatballhat commented 1 year ago

Some of the fields on Command are related and may be grouped together for clarity. For example, these Help.+ fields could be grouped together under a Help field:

or these fields related to shell completion could be under a ShellCompletion field:

or all of these could be grouped under an Options or Config field (?):

cmd := &cli.Command{
    Name: "foo",
    Config: cli.CommandConfig{
        HideHelp: true,
        EnableShellCompletion: true,
    },
}

There are arguable tradeoffs, of course, such as:

Ideas and questions and concerns wanted 🙇🏼

bartekpacia commented 2 months ago

I understand this issue, but I think the way it is currently is just... good enough. I also think that the less we break from v2, the better.

"Flat is better than nested." - The Zen of Python