pflag icon indicating copy to clipboard operation
pflag copied to clipboard

Allow case-insensitive long flag names, perhaps as an option

Open anthonyfok opened this issue 9 years ago • 1 comments

It would be great if pflag could accept case-insensitive long flag names, perhaps as an option, so that it would treat variations like --baseUrl, --baseURL and --baseurl as one and the same.

A discussion that led to this feature request is available at spf13/hugo/issues/959

Many thanks!

anthonyfok avatar Mar 30 '15 16:03 anthonyfok

Since you are using hugo (which I believe in turn uses spf13/cobra and spf13/pflag) you can check out the "normalized name" support. It allows you to write your own custom function which in your case could translate all flags to lowercase.

https://github.com/spf13/cobra/blob/master/command.go#L158 https://github.com/spf13/pflag/blob/master/flag.go#L184

It is being used in kubernetes to turn flags_like_this into flags-like-this so we have a consistent -

eparis avatar Aug 15 '15 05:08 eparis