aboutsummaryrefslogtreecommitdiff
path: root/flag.go
diff options
context:
space:
mode:
authorGrégoire Duchêne <gduchene@awhk.org>2023-02-26 13:04:29 +0000
committerGrégoire Duchêne <gduchene@awhk.org>2023-02-26 13:04:29 +0000
commit7819ffd61f780eded638be342b469a57596a15fe (patch)
tree69db9367883a99506b7d08d825c87444eb80f2ef /flag.go
parente7407fe22c8164a500aaa12ebcd1084cf53d42e1 (diff)
Add ParseString
Diffstat (limited to 'flag.go')
-rw-r--r--flag.go4
1 files changed, 4 insertions, 0 deletions
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.