import std/typetraits, preserves type XdgOpen* {.preservesRecord: "xdg-open".} = object `uris`*: seq[string] UriRunnerConfigKind* {.pure.} = enum `ListenOn`, `ActionHandler` `UriRunnerConfig`*[E] {.preservesOr.} = ref object case orKind*: UriRunnerConfigKind of UriRunnerConfigKind.`ListenOn`: `listenon`*: ListenOn[E] of UriRunnerConfigKind.`ActionHandler`: `actionhandler`*: ActionHandler ListenOn*[E] {.preservesRecord: "listen-on".} = ref object `dataspace`*: Preserve[E] ActionHandler* {.preservesRecord: "action-handler".} = object `pat`*: string `cmd`*: seq[string] proc `$`*[E](x: UriRunnerConfig[E] | ListenOn[E]): string = `$`(toPreserve(x, E)) proc encode*[E](x: UriRunnerConfig[E] | ListenOn[E]): seq[byte] = encode(toPreserve(x, E)) proc `$`*(x: XdgOpen | ActionHandler): string = `$`(toPreserve(x)) proc encode*(x: XdgOpen | ActionHandler): seq[byte] = encode(toPreserve(x))