You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the flag package has functions for parsing string.
In order use a rune flag one has to
define it as string flag
check rune count using utf8.RuneCountInString to know if is has one or more rune.
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. )
type cast it to []rune
get the first rune by using index 0
The text was updated successfully, but these errors were encountered:
The need for a flag that accepts a single rune seems 1) rare; 2) easy to implement by implementing the flag.Value interface. What is the argument for putting this in the standard library? See https://golang.org/doc/faq#x_in_std.
Currently the
flag
package has functions for parsingstring
.In order use a
rune
flag one has tostring
flagutf8.RuneCountInString
to know if is has one or more rune.flag.Usage
and exit. ( But the usage informationthat
flag.Usage
gives will contain-flag string
for that flag. so it requires to add`rune`
to that flag's usageinformation to get
flag.Usage
show-flag rune
for that flag's usage information. )[]rune
rune
by using index0
The text was updated successfully, but these errors were encountered: