parent
724cbe68e1
commit
9b4710ea66
|
@ -1,2 +1,3 @@
|
|||
http_translator
|
||||
json_translator
|
||||
msg
|
||||
|
|
|
@ -9,3 +9,8 @@ See [http_translator.config-example.pr](./http_translator.config-example.pr) for
|
|||
## json_translator
|
||||
|
||||
Wrapper that executes a command, parses its JSON output, and asserts a Preserves conversion in an `<output …>` record.
|
||||
|
||||
|
||||
## msg
|
||||
|
||||
A utility that sends a message to $SYNDICATE_SOCK in the form `<ARGV…>`.
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
# SPDX-FileCopyrightText: ☭ 2022 Emery Hemingway
|
||||
# SPDX-License-Identifier: Unlicense
|
||||
|
||||
import std/[asyncdispatch, os]
|
||||
from std/sequtils import map
|
||||
import preserves, syndicate, syndicate/capabilities
|
||||
|
||||
proc unixSocketPath: string =
|
||||
result = getEnv("SYNDICATE_SOCK")
|
||||
if result == "":
|
||||
result = getEnv("XDG_RUNTIME_DIR", "/run/user/1000") / "dataspace"
|
||||
|
||||
proc mintCap: SturdyRef =
|
||||
var key: array[16, byte]
|
||||
mint(key, "syndicate")
|
||||
|
||||
bootDataspace("main") do (root: Ref; turn: var Turn):
|
||||
let label = getAppFilename().extractFilename
|
||||
connectUnix(turn, unixSocketPath(), mintCap()) do (turn: var Turn; ds: Ref):
|
||||
var a = initRecord[Ref](label, commandLineParams().toPreserve(Ref))
|
||||
message(turn, ds, a)
|
||||
|
||||
for i in 0..7: poll(20)
|
||||
# A hack to exit
|
|
@ -5,7 +5,7 @@ author = "Emery Hemingway"
|
|||
description = "Utilites for Syndicated Actors and Synit"
|
||||
license = "unlicense"
|
||||
srcDir = "src"
|
||||
bin = @["http_translator", "json_translator"]
|
||||
bin = @["http_translator", "json_translator", "msg"]
|
||||
|
||||
|
||||
# Dependencies
|
||||
|
|
Loading…
Reference in New Issue