1
1
mirror of https://github.com/urbit/shrub.git synced 2024-12-23 10:52:12 +03:00
shrub/pkg/arvo/ted/work.hoon
2020-12-06 03:33:43 -08:00

37 lines
1.1 KiB
Plaintext

:: -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
=+ !<(desks=(list desk) arg)
=? 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
::
=/ pax=path (en-beam [ship i.desks case] /)
;< ~ bind:m (poke-our:strandio %hood %kiln-mount !>([pax i.desks]))
;< ~ bind:m (trace:strandio leaf+"work: mounted {<i.desks>}" ~)
::
loop(desks t.desks)