This commit is contained in:
Daylin Morgan 2024-11-07 22:53:12 -06:00
parent 16cc0b910d
commit 7f53ef5df9
Signed by: daylin
GPG key ID: 950D13E9719334AD
2 changed files with 10 additions and 6 deletions

View file

@ -723,19 +723,21 @@ macro hwylCli*(body: untyped) =
when isMainModule: when isMainModule:
import std/strformat import std/strformat
hwylCli: hwylCli:
name "hwylterm" name "hwylterm"
... "a description of hwylterm" ... "a description of hwylterm"
globalFlags:
config:
T seq[string]
? "path to config file"
* @["config.yml"]
flags: flags:
check: check:
T bool T bool
? "load config and exit" ? "load config and exit"
- c - c
# --- other
config:
T seq[string]
? "path to config file"
* @["config.yml"]
# ^ other
run: run:
echo "hello from the main command" echo "hello from the main command"
echo fmt"{config=}, {check=}" echo fmt"{config=}, {check=}"
@ -743,6 +745,7 @@ when isMainModule:
--- a --- a
... "the \"a\" subcommand" ... "the \"a\" subcommand"
flags: flags:
# ^ other
`long-flag` "some help" `long-flag` "some help"
flagg "some other help" flagg "some other help"
run: run:

View file

@ -17,6 +17,7 @@
### cli generato ### cli generato
- [ ] add support for types(metavars)/defaults/required in help output - [ ] add support for types(metavars)/defaults/required in help output
- [ ] add support for enum (parse string)
- [ ] abstract the `globalFlags` argument to a `flagGroups` section with a builtin `global` - [ ] abstract the `globalFlags` argument to a `flagGroups` section with a builtin `global`
this would allow users to "inherit" flag groups in subcommands this would allow users to "inherit" flag groups in subcommands
```nim ```nim