Skip to content

proposal: flag: Introduce functions for defining rune flag #41757

Closed
@ghost

Description

Currently the flag package has functions for parsing string.

In order use a rune flag one has to

  1. define it as string flag
  2. check rune count using utf8.RuneCountInString to know if is has one or more rune.
  3. if rune count is more than one, produce an error or call flag.Usage and exit. ( But the usage information
    that flag.Usage gives will contain -flag string for that flag. so it requires to add `rune` to that flag's usage
    information to get flag.Usage show -flag rune for that flag's usage information. )
  4. type cast it to []rune
  5. get the first rune by using index 0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions