urfave / cli

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

What is the purpose of `normalizeFlags`? #1929

Open fiatjaf opened 3 days ago

fiatjaf commented 3 days ago

I read the code but my understanding of it doesn't match what happens when I remove that function entirely.

It looks like the only things it does in practice is to disallow using the long form and the short form alias of the same flag in a same call.

Is there a reason why that should be disallowed? Or is that a necessity due to some constraint I am not seeing?

dearchap commented 2 days ago

@fiatjaf Thats one of the reasons. The other reason is that the flag aliases values are duplicated into the set for retrieval but set.Value function.