mirror of
https://github.com/daylinmorgan/hwylterm.git
synced 2025-02-23 09:45:50 -06:00
more hwylcli tests
This commit is contained in:
parent
4fd2a249a3
commit
bc4a0a32e9
2 changed files with 7 additions and 0 deletions
|
@ -1069,6 +1069,11 @@ func genPosArgHandler(cfg: CliCfg, body: NimNode) =
|
||||||
body.add quote do:
|
body.add quote do:
|
||||||
result = @[`numArgs`..^1]
|
result = @[`numArgs`..^1]
|
||||||
|
|
||||||
|
# first and last already absorbed the remaining args
|
||||||
|
elif maKind in [First, Last]:
|
||||||
|
body.add quote do:
|
||||||
|
result = @[] # args are ab
|
||||||
|
|
||||||
func addPostParseHook(cfg: CliCfg, body: NimNode) =
|
func addPostParseHook(cfg: CliCfg, body: NimNode) =
|
||||||
## generate block to set defaults and check for required flags
|
## generate block to set defaults and check for required flags
|
||||||
let flagSet = ident"flagSet"
|
let flagSet = ident"flagSet"
|
||||||
|
|
|
@ -9,3 +9,5 @@ suite "hwylcli":
|
||||||
checkRunWithArgs("posLastExact", "a b c d e", """first=a, second=b, third=@["c", "d", "e"]""")
|
checkRunWithArgs("posLastExact", "a b c d e", """first=a, second=b, third=@["c", "d", "e"]""")
|
||||||
checkRunWithArgs("posNoMulti", "5 b c", """first=5, second=b, third=c""")
|
checkRunWithArgs("posNoMulti", "5 b c", """first=5, second=b, third=c""")
|
||||||
checkRunWithArgs("posNoMulti", "5 b c d", """error missing positional args, got: 4, expected: 3""", code = 1)
|
checkRunWithArgs("posNoMulti", "5 b c d", """error missing positional args, got: 4, expected: 3""", code = 1)
|
||||||
|
checkRunWithArgs("enumFlag","--color red", "")
|
||||||
|
checkRunWithArgs("enumFlag","--color black", "")
|
||||||
|
|
Loading…
Add table
Reference in a new issue