mirror of
https://github.com/daylinmorgan/hwylterm.git
synced 2024-12-22 03:00:43 -06:00
add merger for cligen help
This commit is contained in:
parent
337083afe1
commit
78c177e32e
1 changed files with 22 additions and 0 deletions
|
@ -2,6 +2,15 @@
|
||||||
# Hwylterm cligen adapter
|
# Hwylterm cligen adapter
|
||||||
|
|
||||||
Adapter to add hwylterm colors to cligen output.
|
Adapter to add hwylterm colors to cligen output.
|
||||||
|
|
||||||
|
```nim
|
||||||
|
import cligen, hwylterm/cligen
|
||||||
|
proc fun(a: string = "b") =
|
||||||
|
echo a
|
||||||
|
hwylCLi(clCfg)
|
||||||
|
dispatch fun, help = {"a": "option a"}
|
||||||
|
```
|
||||||
|
|
||||||
]##
|
]##
|
||||||
|
|
||||||
import std/[tables]
|
import std/[tables]
|
||||||
|
@ -48,6 +57,19 @@ const
|
||||||
useHdr = "[bold]Usage[/]:\n "
|
useHdr = "[bold]Usage[/]:\n "
|
||||||
use = "$command $args\n${doc}[bold]Options[/]:\n$options"
|
use = "$command $args\n${doc}[bold]Options[/]:\n$options"
|
||||||
|
|
||||||
|
|
||||||
|
func `//`*[A,B](p: openArray[(A,B)]): Table[A,B] =
|
||||||
|
p.toTable()
|
||||||
|
func `//`*[A,B](t1: var Table[A,B], t2: Table[A,B]) =
|
||||||
|
for (k, v) in t2.pairs:
|
||||||
|
t1[k] = v
|
||||||
|
func `//`*[A,B](t1: Table[A,B],t2: Table[A,B]): Table[A,B] =
|
||||||
|
result // t1; result // t2
|
||||||
|
func `//`*[A,B](t: Table[A,B], p: openArray[(A,B)]): Table[A,B] =
|
||||||
|
result // t; result // p.toTable()
|
||||||
|
func `//`*[A,B](p: openArray[(A,B)], t: Table[A,B]): Table[A,B] =
|
||||||
|
result // p.toTable(); result // t;
|
||||||
|
|
||||||
proc hwylCli*(
|
proc hwylCli*(
|
||||||
clcfg: var ClCfg,
|
clcfg: var ClCfg,
|
||||||
styles: CligenStyle = CligenStyle(),
|
styles: CligenStyle = CligenStyle(),
|
||||||
|
|
Loading…
Reference in a new issue