Skip to content
This repository has been archived by the owner on Jun 16, 2022. It is now read-only.

string to enum #22

Open
fjhenigman opened this issue Nov 11, 2014 · 2 comments
Open

string to enum #22

fjhenigman opened this issue Nov 11, 2014 · 2 comments

Comments

@fjhenigman
Copy link
Contributor

A "string to enum" function (inverse of waffle_enum_to_string) would help with writing command line parsing code. For example:
if (argv[1] starts with "WAFFLE_PLATFORM_")
platform = waffle_string_to_enum(argv[1])
else
print usage
This way when waffle grows new platforms, they can be used without having to update any code.
If there are no objections I can write this.

@linyaa-kiwi
Copy link
Member

No objections. Please go ahead.

@jljusten
Copy link
Member

The function seems fine, but a tool that has a command line parameter of WAFFLE_PLATFORM_FOO seems a bit silly. I prefer -p foo / --platform=foo like wflinfo has.

In https://github.com/jljusten/waffle/tree/wflgears, I was trying to separate out the wflinfo command line parsing to use it in a new wflgears tool. (But, the branch has stalled for some months now...)

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

No branches or pull requests

3 participants