hwylterm/tests/cli/clis/inheritFlags.nim

33 lines
610 B
Nim
Raw Permalink Normal View History

2025-01-29 15:35:05 -06:00
import std/strformat
import hwylterm, hwylterm/hwylcli
hwylCli:
2025-01-29 16:11:16 -06:00
name "inherit-flags"
2025-01-29 15:35:05 -06:00
flags:
[global]
always "in all subcommands"
[misc]
misc1 "first misc flag"
misc2 "second misc flag"
subcommands:
[first]
... "command with it's own flag"
flags:
first "first first flag"
run:
echo fmt"{always=},{first=}"
[second]
... "command with 'misc' flags"
flags:
^[misc]
run:
echo fmt"{always=},{misc1=},{misc2=}"
[third]
... "command with only 'misc1' flag"
flags:
^misc1
run:
echo fmt"{always=},{misc1=}"