msg: parse command line as text Preserves
This commit is contained in:
parent
3a3fc0db2d
commit
8c322d1efd
18
src/msg.nim
18
src/msg.nim
|
@ -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()
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue