Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
anthonyfok opened this issue Mar 30, 2015 · 1 comment
Open

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

anthonyfok opened this issue Mar 30, 2015 · 1 comment

Comments

@anthonyfok
Copy link

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 gohugoio/hugo/issues/959

Many thanks!

@eparis
Copy link

eparis commented Aug 15, 2015

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 -

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants