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

Consider allowing users to pass in structs of options #12

Open
integrii opened this issue May 9, 2018 · 3 comments
Open

Consider allowing users to pass in structs of options #12

integrii opened this issue May 9, 2018 · 3 comments
Labels
proposal Proposed changes to flaggy

Comments

@integrii
Copy link
Owner

integrii commented May 9, 2018

It could be convenient to pass in a pointer to a struct for options. Flaggy could loop over the struct fields, and depending on the property type and name, assign variables into it.

@integrii integrii added the proposal Proposed changes to flaggy label May 9, 2018
@maxatome
Copy link

Or using tags:

type Options struct {
  Name       string `flaggy:"n,name,rest is description"` // short=n, long=name
  Address    string `flaggy:",address"`                   // no short, long=address, without description
  Subscribed bool   `flaggy:"s"`                          // short=s, no long, without description
  Quiet      bool   `flaggy:"q,,quiet mode"`              // short=q, no long
}

@integrii
Copy link
Owner Author

I am leaning toward calling this "out of scope" for flaggy because its so radically different than the currently patterns. I think go-flags already does a pretty good job of this.

The user experience will likely suffer if there are too many ways to do things.

I'm leaving this open for now for more discussion.

@olekukonko
Copy link

(fig)[https://github.com/kkyr/fig] seems to do a better job at this by supporting subcommands however it makes sense for flaggy to have this.

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

No branches or pull requests

3 participants