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 insensitivity in arg_enum! macro #104

Closed
kbknapp opened this issue May 5, 2015 · 0 comments · Fixed by #105
Closed

Allow case insensitivity in arg_enum! macro #104

kbknapp opened this issue May 5, 2015 · 0 comments · Fixed by #105
Labels
C-enhancement Category: Raise on the bar on expectations

Comments

@kbknapp
Copy link
Member

kbknapp commented May 5, 2015

Currently if you use arg_enum! to create possible values into an enum, you must either allow non-camel-case enum variants (to suppress the warning), or force users to start their possible values with an upper case character. For example, if you had a --mode which accepted an arg_enum! of

arg_enum! {
    enum {
        Vi,
        Emacs
    }
}

The user must use $ myprog --mode Vi which isn't optimal. This enum should be able to match vi or Vi.

Simply converting to lowercase is also a very tricky subject if utf-8 is to be supported. But being, I don't use any non-ascii characters on a regular basis, I'm unfamiliar with capital/lowercase unicode graphemes.

@kbknapp kbknapp added the C-enhancement Category: Raise on the bar on expectations label May 5, 2015
kbknapp added a commit that referenced this issue May 5, 2015
Allows creating an enum with CamelCase to follow Rust guidelines, but
then will match ascii case insensitive. This means variant
SomeEnum::Emacs would match string "emacs".

Closes #104
kbknapp added a commit that referenced this issue May 5, 2015
Allows creating an enum with CamelCase to follow Rust guidelines, but
then will match ascii case insensitive. This means variant
SomeEnum::Emacs would match string "emacs".

Closes #104
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Raise on the bar on expectations
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant