urbit/pkg/arvo/ted/work.hoon

37 lines
1.1 KiB
Plaintext
Raw Normal View History

2020-05-15 11:00:56 +03:00
:: -work: create and mount development desk(s)
::
:: With no arguments, creates and mounts a %work desk.
:: If there are arguments, each one is created and mounted.
:: All desks are begun by merging from our %home desk.
::
/- spider
/+ strandio
=, strand=strand:spider
^- thread:spider
|= arg=vase
=/ m (strand ,vase)
^- form:m
2021-06-08 05:54:26 +03:00
=+ !<([~ desks=(list desk)] arg)
2020-05-15 11:00:56 +03:00
=? desks =(~ desks) [%work]~
|- ^- form:m
=* loop $
?~ desks (pure:m !>(ok=&))
:: |merge %work our %home
::
;< [=ship =desk =case:clay] bind:m get-beak:strandio
=/ kiln-merge [i.desks ship %home case %auto]
;< ~ bind:m (poke-our:strandio %hood %kiln-merge !>(kiln-merge))
;< ~ bind:m (trace:strandio leaf+"work: merged {<i.desks>}" ~)
:: sleep 10ms to defer to new event
::
:: TODO: This crashes if it's in the same event for some reason.
::
;< ~ bind:m (sleep:strandio `@dr`(div ~s1 100))
:: |mount %work
::
2020-12-06 12:03:12 +03:00
=/ pax=path (en-beam [ship i.desks case] /)
2020-05-15 11:00:56 +03:00
;< ~ bind:m (poke-our:strandio %hood %kiln-mount !>([pax i.desks]))
;< ~ bind:m (trace:strandio leaf+"work: mounted {<i.desks>}" ~)
::
loop(desks t.desks)