diff options
| author | Grégoire Duchêne <gduchene@awhk.org> | 2023-02-26 13:04:29 +0000 |
|---|---|---|
| committer | Grégoire Duchêne <gduchene@awhk.org> | 2023-02-26 13:04:29 +0000 |
| commit | 7819ffd61f780eded638be342b469a57596a15fe (patch) | |
| tree | 69db9367883a99506b7d08d825c87444eb80f2ef | |
| parent | e7407fe22c8164a500aaa12ebcd1084cf53d42e1 (diff) | |
Add ParseString
| -rw-r--r-- | flag.go | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -169,6 +169,10 @@ func ParseProtobufEnum[T ~int32](values map[string]int32) ParseFunc[T] { } } +// ParseString is a trivial function that is designed to be used with +// FlagSlice and FlagSliceVar. +func ParseString(s string) (string, error) { return s, nil } + // ParseStringEnum returns a ParseFunc that will return the string // passed if it matched any of the values supplied. If no such match is // found, an UnknownEnumValueError is returned. |
