Skip to content

Consider allowing users to pass in structs of options #12

Description

@integrii

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.

Activity

  1. maxatome commented on Jul 11, 2018

    @maxatome

    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
    }
  2. integrii commented on Jul 12, 2018

    @integrii
    OwnerAuthor

    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.

  3. olekukonko commented on May 21, 2020

    @olekukonko

    (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

Metadata

Metadata

Assignees

No one assigned

    Labels

    proposalProposed changes to flaggy

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions