Use the "during" macro
This commit is contained in:
parent
1c22d61d0f
commit
074eb4ec16
|
@ -14,7 +14,6 @@ bootDataspace("main") do (root: Ref; turn: var Turn):
|
||||||
connectStdio(root, turn)
|
connectStdio(root, turn)
|
||||||
|
|
||||||
onPublish(turn, root, ?ActionHandler) do (pat: string; cmd: seq[Assertion]):
|
onPublish(turn, root, ?ActionHandler) do (pat: string; cmd: seq[Assertion]):
|
||||||
# TODO: during
|
|
||||||
if cmd.len < 2:
|
if cmd.len < 2:
|
||||||
stderr.writeLine "ignoring ", $cmd, " for ", pat
|
stderr.writeLine "ignoring ", $cmd, " for ", pat
|
||||||
else:
|
else:
|
||||||
|
@ -24,7 +23,7 @@ bootDataspace("main") do (root: Ref; turn: var Turn):
|
||||||
else:
|
else:
|
||||||
stderr.writeLine "not a valid program specification: ", cmd[0]
|
stderr.writeLine "not a valid program specification: ", cmd[0]
|
||||||
|
|
||||||
onPublish(turn, root, ?ListenOn[Ref]) do (a: Assertion):
|
during(turn, root, ?ListenOn[Ref]) do (a: Assertion):
|
||||||
let ds = unembed a
|
let ds = unembed a
|
||||||
onMessage(turn, ds, ?XdgOpen) do (uris: seq[string]):
|
onMessage(turn, ds, ?XdgOpen) do (uris: seq[string]):
|
||||||
while children.len > 0 and not children.peekFirst.running:
|
while children.len > 0 and not children.peekFirst.running:
|
||||||
|
@ -52,5 +51,9 @@ bootDataspace("main") do (root: Ref; turn: var Turn):
|
||||||
children.addLast child
|
children.addLast child
|
||||||
if not matched:
|
if not matched:
|
||||||
stderr.writeLine "no actions matched for ", uri
|
stderr.writeLine "no actions matched for ", uri
|
||||||
|
do:
|
||||||
|
# The Syndicate server retracts all assertions when
|
||||||
|
# the config is rewritten.
|
||||||
|
actions.setLen 0
|
||||||
|
|
||||||
runForever()
|
runForever()
|
||||||
|
|
|
@ -15,10 +15,8 @@ proc mintCap: SturdyRef =
|
||||||
var key: array[16, byte]
|
var key: array[16, byte]
|
||||||
mint(key, "syndicate")
|
mint(key, "syndicate")
|
||||||
|
|
||||||
bootDataspace("main") do (ds: Ref; turn: var Turn):
|
bootDataspace("main") do (root: Ref; turn: var Turn):
|
||||||
let mainFacet = turn.facet
|
connectUnix(turn, unixSocketPath(), mintCap()) do (turn: var Turn; ds: Ref):
|
||||||
connectUnix(turn, unixSocketPath(), mintCap()) do (turn: var Turn; a: Assertion) -> TurnAction:
|
|
||||||
let ds = unembed a
|
|
||||||
message(turn, ds, XdgOpen(uris: commandLineParams()))
|
message(turn, ds, XdgOpen(uris: commandLineParams()))
|
||||||
|
|
||||||
for i in 0..7: poll(20)
|
for i in 0..7: poll(20)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Package
|
# Package
|
||||||
|
|
||||||
version = "0.3.0"
|
version = "0.3.1"
|
||||||
author = "Emery"
|
author = "Emery"
|
||||||
description = "A better xdg-open"
|
description = "A better xdg-open"
|
||||||
license = "Unlicense"
|
license = "Unlicense"
|
||||||
|
@ -10,4 +10,4 @@ bin = @[ "uri_runner", "xdg_open"]
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
|
|
||||||
requires "nim >= 1.6.4", "syndicate"
|
requires "nim >= 1.6.4", "syndicate >= 1.3.0"
|
||||||
|
|
Loading…
Reference in New Issue