msg: parse command line as text Preserves

This commit is contained in:
Emery Hemingway 2023-05-17 21:05:33 +01:00
parent 3a3fc0db2d
commit 8c322d1efd
2 changed files with 12 additions and 10 deletions

View File

@ -1,7 +1,7 @@
# SPDX-FileCopyrightText: ☭ 2022 Emery Hemingway
# SPDX-FileCopyrightText: ☭ Emery Hemingway
# SPDX-License-Identifier: Unlicense
import std/[asyncdispatch, os]
import std/[asyncdispatch, sequtils, os]
import preserves, syndicate, syndicate/capabilities
proc unixSocketPath: string =
@ -9,11 +9,13 @@ proc unixSocketPath: string =
if result == "":
result = getEnv("XDG_RUNTIME_DIR", "/run/user/1000") / "dataspace"
bootDataspace("main") do (root: Ref; turn: var Turn):
proc main =
let label = getAppFilename().extractFilename
connectUnix(turn, unixSocketPath(), capabilities.mint()) do (turn: var Turn; ds: Ref):
var a = initRecord[Ref](label, commandLineParams().toPreserve(Ref))
message(turn, ds, a)
bootDataspace(label) do (root: Ref; turn: var Turn):
connectUnix(turn, unixSocketPath(), capabilities.mint()) do (turn: var Turn; ds: Ref):
message(turn, ds, initRecord(label, map(commandLineParams(), parsePreserves)))
for i in 0..7: poll(20)
# A hack to exit
for i in 0..3: poll(20)
# A hack to exit
main()

View File

@ -1,6 +1,6 @@
# Package
version = "20230516"
version = "20230517"
author = "Emery Hemingway"
description = "Utilites for Syndicated Actors and Synit"
license = "unlicense"
@ -10,4 +10,4 @@ bin = @["json_socket_translator", "json_translator", "msg"]
# Dependencies
requires "nim >= 1.6.6", "syndicate >= 0.3.1"
requires "nim >= 1.6.6", "syndicate >= 20230517"