From ef573dc0f8bf39f80704f92cfab39e1b9af82492 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Tue, 19 Nov 2024 14:39:27 -0600 Subject: [PATCH] support other default sep char --- src/hwylterm/hwylcli.nim | 4 ++-- tests/example.nim | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/hwylterm/hwylcli.nim b/src/hwylterm/hwylcli.nim index 622933d..fdccffa 100644 --- a/src/hwylterm/hwylcli.nim +++ b/src/hwylterm/hwylcli.nim @@ -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 diff --git a/tests/example.nim b/tests/example.nim index 766c137..01a73aa 100644 --- a/tests/example.nim +++ b/tests/example.nim @@ -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=}"