cli
cli copied to clipboard
How to stop flag from sorting automatically for --help?
Previously I was using "github.com/urfave/cli" v1 and when I entered --help it displayed the flags in the order I filled them in, but when I used v2 all the flags were automatically sorted, how can I stop the automatic sorting? I didn't find any place where I can set it.
@FGYFFFF This behavior was introduced recently in the v2
series via flag category support. Given that there's an expectation that the default sort order should not be by name, I'd like to explore reverting to the previous behavior. Is this something you're willing and able to contribute?
Yes,I am willing to do it
@FGYFFFF Great! Thank you!
Looking at this again, I think the change to automatically sorting the flags is arguably a regression because the current documentation claims that the default ordering is not sorted.:
https://cli.urfave.org/v2/#ordering
Fixed in release v2.19.2