shrub/base/lib/helm.hoon

166 lines
7.0 KiB
Plaintext
Raw Normal View History

2015-05-11 20:53:47 +03:00
:: :: ::
:::: /hook/core/helm/lib :: ::
:: :: ::
/? 310 :: version
:: :: ::
:::: :: ::
:: :: ::
|% :: ::
++ helm-part ,[%helm %0 helm-pith] :: helm state
++ helm-pith :: helm content
$: bur=(unit (pair ship mace)) :: requesting ticket
2015-05-11 20:53:47 +03:00
hoc=(map bone helm-session) :: consoles
== ::
++ helm-session ::
$: say=sole-share :: console state
mud=(unit (sole-dialog ,@ud)) :: console dialog
== ::
:: :: ::
:::: :: ::
:: :: ::
2015-05-12 03:31:37 +03:00
++ hood-begin :: begin command
2015-05-11 20:53:47 +03:00
$: his=@p :: identity
tic=@p :: ticket
eny=@t :: entropy
ges=gens :: description
== ::
2015-05-12 03:31:37 +03:00
++ hood-init :: report init
2015-05-11 20:53:47 +03:00
$: him=ship ::
== ::
2015-05-12 03:31:37 +03:00
++ hood-reset :: reset command
2015-05-11 20:53:47 +03:00
,~ ::
++ helm-verb :: reset command
,~ ::
2015-05-12 03:31:37 +03:00
++ hood-reload :: reload command
2015-05-11 20:53:47 +03:00
(list term) ::
-- ::
:: :: ::
:::: :: ::
!: :: ::
|% :: helm library
++ helm-work :: work in helm
2015-05-28 09:51:32 +03:00
|= [bowl helm-part]
2015-05-11 20:53:47 +03:00
=+ sez=(fall (~(get by hoc) ost) *helm-session)
=> |% :: arvo structures
++ card ::
$% [%cash wire p=@p q=buck] ::
[%conf wire dock %load ship term] ::
[%flog wire flog] ::
2015-06-04 00:18:13 +03:00
[%poke wire dock pear] ::
2015-05-11 20:53:47 +03:00
[%want wire sock path *] :: send message
== ::
++ move (pair bone card) :: user-level move
2015-06-04 00:18:13 +03:00
++ pear :: poke fruit
$% [%hood-unsync desk ship desk] ::
[%talk-command command:talk] ::
2015-06-04 00:18:13 +03:00
== ::
2015-05-11 20:53:47 +03:00
--
|_ moz=(list move)
++ abet :: resolve
[(flop moz) %_(+>+>+<+ hoc (~(put by hoc) ost sez))]
::
++ emit |=(card %_(+> moz [[ost +<] moz])) :: return card
++ emil :: return cards
|= (list card)
^+ +>
?~(+< +> $(+< t.+<, +> (emit i.+<)))
::
++ poke-begin :: make/send keypair
2015-05-12 03:31:37 +03:00
|= hood-begin =< abet
2015-05-11 20:53:47 +03:00
?> ?=(~ bur)
=+ buz=(shax :(mix (jam ges) eny))
=+ loy=(bruw 2.048 buz)
%- emit(bur `[his [0 sec:ex:loy]~])
[%want /helm/ticket [our (sein his)] /q/ta his tic ges pub:ex:loy]
2015-05-11 20:53:47 +03:00
::
++ poke-init :: initialize
|= him=ship =< abet
(emit %flog /helm %crud %hax-init leaf/(scow %p him) ~)
::
2015-05-19 04:16:32 +03:00
++ poke-mass
2015-05-30 10:53:19 +03:00
|= ~ =< abet
2015-05-19 04:16:32 +03:00
(emit %flog /heft %crud %hax-heft ~)
::
2015-05-30 10:53:19 +03:00
++ poke-reload |=(all=(list term) (poke-reload-desk %home all))
++ poke-reload-desk :: reload vanes
|= [syd=desk all=(list term)] =< abet
2015-05-11 20:53:47 +03:00
%- emil
2015-05-19 04:16:32 +03:00
%- flop
2015-05-11 20:53:47 +03:00
%+ turn all
2015-06-02 23:09:21 +03:00
=+ top=`path`/(scot %p our)/[syd]/(scot %da now)/arvo
=+ ark=(arch .^(%cy top))
2015-05-11 20:53:47 +03:00
=+ van=(~(tap by r.ark))
|= nam=@tas
=. nam
?. =(1 (met 3 nam))
nam
=+ ^- zaz=(list ,[p=span ~])
(skim van |=([a=term ~] =(nam (end 3 1 a))))
?> ?=([[@ ~] ~] zaz)
`term`p.i.zaz
=+ tip=(end 3 1 nam)
2015-06-02 23:09:21 +03:00
=+ way=(welp top /[nam])
=+ fil=(,@ .^(%cx (welp way /hoon)))
[%flog /reload [%veer ?:(=('z' tip) %$ tip) way fil]]
2015-05-11 20:53:47 +03:00
::
2015-06-02 02:25:22 +03:00
++ poke-invite :: send invite; fake
|= [who=@p myl=@t] =< abet
2015-06-02 02:25:22 +03:00
%^ emit %poke /helm/invite
:- [our %talk]
(said our %helm now eny [%leaf "invited: {<who>} at {(trip myl)}"]~)
2015-05-11 20:53:47 +03:00
::
++ poke-reset :: reset system
2015-05-12 03:31:37 +03:00
|= hood-reset =< abet
2015-05-11 20:53:47 +03:00
%- emil
2015-05-30 10:53:19 +03:00
%- flop ^- (list card)
=+ top=`path`/(scot %p our)/home/(scot %da now)/arvo
2015-05-11 20:53:47 +03:00
:- [%flog /reset %vega (weld top `path`/hoon)]
%+ turn
^- (list ,[p=@tas q=@tas])
:~ [%$ %zuse]
[%a %ames]
[%c %clay]
[%d %dill]
[%e %eyre]
[%f %ford]
[%g %gall]
[%t %time]
==
|= [p=@tas q=@tas]
=+ way=`path`(welp top /[q])
=+ txt=((hard ,@) .^(%cx (welp way /hoon)))
[%flog /reset %veer p way txt]
::
++ poke-will :: hear certificate
|= wil=(unit will)
2015-05-11 20:53:47 +03:00
?> ?=(^ bur)
?> ?=(^ wil)
=< abet
2015-05-11 20:53:47 +03:00
%- emil(bur ~)
:~ [%cash /helm p.u.bur q.u.bur u.wil]
2015-06-04 00:18:13 +03:00
~& [%unsyncing our %base (sein our) %kids]
[%poke /helm [our %hood] %hood-unsync %base (sein our) %kids]
2015-05-11 20:53:47 +03:00
==
::
++ poke-verb :: toggle verbose
2015-05-11 20:53:47 +03:00
|= ~ =< abet
(emit %flog /helm %verb ~)
::
++ take-onto :: result of %conf
|= saw=(each suss tang) =< abet
%- emit
?- -.saw
%| [%flog ~ %crud %onto `tang`p.saw]
%& [%flog ~ %text "<{<p.saw>}>"]
==
::
2015-05-15 02:27:45 +03:00
++ take-note :: result of %init
|= [way=wire chr=@tD tan=tank] =< abet
(emit %flog ~ %text chr ' ' ~(ram re tan))
::
++ take-went :: result of %want
|= [way=path her=ship kay=cape] =< abet
(emit %flog ~ %text "went: {<[way kay]>}")
2015-05-11 20:53:47 +03:00
--
--