support other default sep char

This commit is contained in:
Daylin Morgan 2024-11-19 14:39:27 -06:00
parent c5f70cec4e
commit ef573dc0f8
Signed by: daylin
GPG key ID: 950D13E9719334AD
2 changed files with 6 additions and 6 deletions

View file

@ -744,7 +744,7 @@ proc parse*(p: OptParser, target: var float) =
proc parse*[T](p: var OptParser, target: var seq[T]) =
checkVal p
case p.sep
of ",=":
of ",=", ",:":
let baseVal = p.val
for v in baseVal.split(","):
p.val = v.strip()
@ -752,7 +752,7 @@ proc parse*[T](p: var OptParser, target: var seq[T]) =
var parsed: T
parse(p, parsed)
target.add parsed
of "=", "":
of "=",":","":
var parsed: T
parse(p, parsed)
target.add parsed

View file

@ -72,16 +72,16 @@ hwylCli:
flags:
^something
thing:
T KV[string, Color]
? "some key value string"
T seq[KV[string, Color]]
? "some key value colors"
b:
T seq[float]
? "multiple floats"
h "this will override the builtin 'h' for help"
def:
T string
? "a flag with a string default"
* "the value"
run:
echo "hello from `example b` command"
echo fmt"{thing=}, {b=}, {h=}, {def=}"
echo fmt"{thing=}, {b=}, {def=}"