From 7819ffd61f780eded638be342b469a57596a15fe Mon Sep 17 00:00:00 2001 From: GrĂ©goire DuchĂȘne Date: Sun, 26 Feb 2023 13:04:29 +0000 Subject: Add ParseString --- flag.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/flag.go b/flag.go index 42f4537..18d9f96 100644 --- a/flag.go +++ b/flag.go @@ -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. -- cgit v1.2.3-70-g09d2