You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
676 B
30 lines
676 B
1 year ago
|
|
||
|
import
|
||
|
std/typetraits, preserves
|
||
|
|
||
|
type
|
||
|
XdgOpen* {.preservesRecord: "xdg-open".} = object
|
||
|
`data`*: seq[string]
|
||
|
|
||
|
Attrs*[E] {.preservesDictionary.} = ref object
|
||
|
`actions`*: seq[Action]
|
||
|
|
||
|
UriRunnerConfig*[E] {.preservesRecord: "config".} = ref object
|
||
|
`attrs`*: Attrs[E]
|
||
|
|
||
|
Action* {.preservesTuple.} = object
|
||
|
`pat`*: string
|
||
|
`cmd`*: seq[string]
|
||
|
|
||
|
proc `$`*[E](x: Attrs[E] | UriRunnerConfig[E]): string =
|
||
|
`$`(toPreserve(x, E))
|
||
|
|
||
|
proc encode*[E](x: Attrs[E] | UriRunnerConfig[E]): seq[byte] =
|
||
|
encode(toPreserve(x, E))
|
||
|
|
||
|
proc `$`*(x: XdgOpen | Action): string =
|
||
|
`$`(toPreserve(x))
|
||
|
|
||
|
proc encode*(x: XdgOpen | Action): seq[byte] =
|
||
|
encode(toPreserve(x))
|