Skip to content

Option.Default field? #2

Description

@elithrar

Has an Option.Default field been considered? I prefer to write options without struct tags (since struct tags aren't checked by the compiler, leading to my issue yesterday), but right now you need to write the following:

    {
        Names:       []string{"count"},
        Description: "The (maximum) number of logs to request.",
        Placeholder: "<num>",
        Decoder:     writ.NewDefaulter(writ.NewOptionDecoder(config.Count), "1"),
    },

This isn't bad, but it:

  • Limits you to strings - if the field is an int64 or other time (say, for Unix timestamps) then you can't set a default.
  • A Default field would be more explicit and would better map against the existing struct tag names.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions