mirror of
https://github.com/daylinmorgan/hwylterm.git
synced 2024-12-22 03:00:43 -06:00
support other default sep char
This commit is contained in:
parent
c5f70cec4e
commit
ef573dc0f8
2 changed files with 6 additions and 6 deletions
|
@ -744,7 +744,7 @@ proc parse*(p: OptParser, target: var float) =
|
||||||
proc parse*[T](p: var OptParser, target: var seq[T]) =
|
proc parse*[T](p: var OptParser, target: var seq[T]) =
|
||||||
checkVal p
|
checkVal p
|
||||||
case p.sep
|
case p.sep
|
||||||
of ",=":
|
of ",=", ",:":
|
||||||
let baseVal = p.val
|
let baseVal = p.val
|
||||||
for v in baseVal.split(","):
|
for v in baseVal.split(","):
|
||||||
p.val = v.strip()
|
p.val = v.strip()
|
||||||
|
@ -752,7 +752,7 @@ proc parse*[T](p: var OptParser, target: var seq[T]) =
|
||||||
var parsed: T
|
var parsed: T
|
||||||
parse(p, parsed)
|
parse(p, parsed)
|
||||||
target.add parsed
|
target.add parsed
|
||||||
of "=", "":
|
of "=",":","":
|
||||||
var parsed: T
|
var parsed: T
|
||||||
parse(p, parsed)
|
parse(p, parsed)
|
||||||
target.add parsed
|
target.add parsed
|
||||||
|
|
|
@ -72,16 +72,16 @@ hwylCli:
|
||||||
flags:
|
flags:
|
||||||
^something
|
^something
|
||||||
thing:
|
thing:
|
||||||
T KV[string, Color]
|
T seq[KV[string, Color]]
|
||||||
? "some key value string"
|
? "some key value colors"
|
||||||
b:
|
b:
|
||||||
T seq[float]
|
T seq[float]
|
||||||
? "multiple floats"
|
? "multiple floats"
|
||||||
h "this will override the builtin 'h' for help"
|
|
||||||
def:
|
def:
|
||||||
|
T string
|
||||||
? "a flag with a string default"
|
? "a flag with a string default"
|
||||||
* "the value"
|
* "the value"
|
||||||
run:
|
run:
|
||||||
echo "hello from `example b` command"
|
echo "hello from `example b` command"
|
||||||
echo fmt"{thing=}, {b=}, {h=}, {def=}"
|
echo fmt"{thing=}, {b=}, {def=}"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue