shrub/main/app/terminal/core.hook

230 lines
7.0 KiB
Plaintext
Raw Normal View History

2014-09-12 06:11:03 +04:00
:: Terminal
::
:::: /hook/core/terminal/app
::
/? 314 :: need urbit 314
2014-10-22 06:59:05 +04:00
/- term-line, term-in, term-ctrl, kyev
2014-10-14 00:00:28 +04:00
/= stat /:/%%/:/hymn/
2014-09-12 06:11:03 +04:00
::
:::: structures
::
|% ::
++ axle $: %1 ::
hiz=(map path term-line) ::
2014-09-12 06:11:03 +04:00
== ::
++ gilt ::
$% [%term-line p=term-line] ::
[%hymn p=manx] ::
== ::
++ gift ::
$% [%rush gilt] ::
[%rust gilt] ::
[%mean p=ares] ::
[%nice ~] ::
2014-10-22 06:59:05 +04:00
[%sage p=path q=*] ::
2014-10-04 02:31:16 +04:00
[%veer p=@ta q=path r=@t] ::
[%vega p=path] ::
2014-09-12 06:11:03 +04:00
== ::
++ hapt ,[p=ship q=path] ::
2014-10-22 23:13:07 +04:00
++ mess ::
$% [%txt p=(hypo cord)] ::
[%kyev p=(hypo kyev)] ::
== ::
2014-09-12 06:11:03 +04:00
++ move ,[p=bone q=(mold note gift)] ::
++ note ::
$% $: %g ::
2014-09-23 02:20:47 +04:00
$% [%cide p=span] ::
[%show p=hapt q=ship r=path] ::
2014-09-12 06:11:03 +04:00
[%sire p=term q=span] ::
2014-10-22 23:13:07 +04:00
[%mess p=hapt q=ship r=mess] ::
2014-09-12 06:11:03 +04:00
== == == ::
++ sign ::
$% $: %g ::
2014-09-23 02:20:47 +04:00
$% [%gone p=hapt] ::
2014-09-12 06:11:03 +04:00
[%mean p=ares] ::
2014-09-23 02:20:47 +04:00
[%nice ~] ::
2014-10-03 02:21:23 +04:00
[%rust p=%term-line q=term-line] ::
[%rush p=%term-line q=term-line] ::
2014-10-22 06:59:05 +04:00
[%sage p=path q=*] ::
2014-10-04 02:31:16 +04:00
[%veer p=@ta q=path r=@t] ::
[%vega p=path] ::
2014-09-12 06:11:03 +04:00
== == ==
--
::
2014-10-14 00:00:28 +04:00
:::: helpers
::
|%
2014-10-22 23:13:07 +04:00
++ aut %shell
++ encode
|= [a=term b=path] ^- span
(rap 3 a (turn b |=(c=span (cat 3 '_' c))))
::
++ decode |=(a=span `[p=term q=path]`(rash a (most cab sym)))
2014-10-14 00:00:28 +04:00
++ inject
|= [a=[i=mane t=(list mane)] b=marl]
|= man=manx
?. =(i.a n.g.man)
man
?~ t.a
man(c (weld c.man b))
man(c (turn c.man ^$(a t.a)))
--
2014-09-12 06:11:03 +04:00
!:
:::: program
::
|_ [hid=hide axle]
2014-10-22 21:19:18 +04:00
++ get-shell
|= [ost=bone you=ship pax=path]
^- [mof=(list move) tel=term-line hit=(map path term-line)]
=+ tel=(fall (~(get by hiz) pax) *term-line)
=+ auc=(encode aut pax)
?: (~(has by cub.hid) auc)
[~ tel hiz]
=. tel tel(r :_(r.tel leaf/"+ {(trip aut)}"))
:_ [tel (~(put by hiz) pax tel)]
2014-10-22 23:13:07 +04:00
(start-shell ost you pax)
::
++ start-shell
|= [ost=bone you=ship pax=path]
^- (list move)
=+ auc=(encode aut pax)
2014-10-23 01:49:47 +04:00
:_ [ost %pass [%fork pax] %g %sire [aut auc]]~
:^ ost %pass [%resp pax]
2014-10-22 21:19:18 +04:00
:+ %g %show
[[our.hid [auc imp.hid]] you /out]
::
2014-10-22 23:13:07 +04:00
++ end-shell
|= [ost=bone pax=path]
^- move
=+ auc=(encode aut pax)
2014-10-23 01:49:47 +04:00
[ost %pass [%fork pax] %g %cide auc]
2014-10-22 23:13:07 +04:00
::
2014-09-12 06:11:03 +04:00
++ page
|= pax=path
2014-10-14 00:00:28 +04:00
%. stat
%+ inject
~[%html %head]
;= ;script: urb.appl = "{(trip app.hid)}"
;script: urb.term = \{pax: "{(spud pax)}"}
2014-09-12 06:11:03 +04:00
==
::
++ peer
|= [ost=bone you=ship pax=path]
^- [(list move) _+>]
?~ pax
$(pax /term)
2014-10-22 23:13:07 +04:00
=+ (get-shell ost you t.pax)
2014-10-22 21:19:18 +04:00
=. hiz hit
:_ +>.$ :_ mof
2014-09-12 06:11:03 +04:00
?+ -.pax !!
2014-10-22 23:13:07 +04:00
%term [ost %give %rust %hymn (page t.pax)] :: hymn front end
2014-10-23 07:35:13 +04:00
%lines (jell ost tel) :: term-line output
2014-09-12 06:11:03 +04:00
==
::
2014-10-22 06:59:05 +04:00
++ poke-term-in
|= [ost=bone you=ship term-in]
2014-09-12 06:11:03 +04:00
^- [(list move) _+>]
=+ tel=(fall (~(get by hiz) pax) *term-line)
2014-09-12 06:11:03 +04:00
?- -.jof
2014-10-22 23:13:07 +04:00
%res :: restart shell
=+ joc=(encode aut pax)
2014-10-03 03:00:57 +04:00
=^ mof r.tel
2014-10-11 03:34:29 +04:00
?. (~(has by cub.hid) joc)
2014-10-03 03:00:57 +04:00
[~ r.tel]
2014-10-22 23:13:07 +04:00
:- [(end-shell ost pax) ~]
[leaf/"- {(trip aut)}" r.tel]
2014-10-11 03:34:29 +04:00
=. r.tel :_(r.tel leaf/"+ {(trip joc)}")
2014-10-02 23:46:00 +04:00
=. hiz (~(put by hiz) pax tel)
2014-10-22 23:13:07 +04:00
:_ +>.$
;: welp
mof
[ost %give %nice ~]~
(start-shell ost you pax)
(spam pax tel)
==
2014-09-23 02:20:47 +04:00
::
2014-10-22 23:13:07 +04:00
%line :: command entered
=. r.tel
:_ r.tel
2014-10-23 03:20:34 +04:00
rose/[~ ~ ~]^~[leaf/(trip p.tel) leaf/(trip p.jof)]
2014-10-02 23:46:00 +04:00
=. hiz (~(put by hiz) pax tel)
2014-10-10 02:40:45 +04:00
?: =('\\' (end 3 1 p.jof))
$(jof [%cmd (rsh 3 1 p.jof)])
2014-10-22 23:13:07 +04:00
:_ +>.$
(send ost you pax %txt -:!>(*cord) p.jof)
%cmd :: key command
?+ p.jof
:_ +>.$
%^ send ost you
[pax %kyev -:!>(*kyev) [[%ctrl ~ ~] p.jof]]
2014-10-10 02:33:00 +04:00
%r $(jof [%res 'shell'])
==
2014-09-12 06:11:03 +04:00
==
2014-10-22 06:59:05 +04:00
::
++ poke-term-ctrl
|= [ost=bone you=ship col=term-ctrl]
^- [(list move) _+>]
2014-10-22 23:13:07 +04:00
=+ (get-shell ost you /)
:_ +>.$(hiz hit) :_ mof
[ost %give %rush %term-line [p q ~]:tel]
2014-10-22 06:59:05 +04:00
::
2014-10-10 01:58:47 +04:00
++ send
2014-10-22 23:13:07 +04:00
|= [ost=bone you=ship pax=path mez=mess]
2014-10-10 01:58:47 +04:00
%+ murn (~(tap by cub.hid))
|= [p=span q=term]
?. =(pax q:(decode p)) ~
%- some ^- move
2014-10-22 23:13:07 +04:00
:^ ost %pass [-.mez (scot %da lat.hid) pax]
2014-10-11 03:34:29 +04:00
[%g %mess [our.hid p imp.hid] you mez]
2014-09-12 06:11:03 +04:00
::
2014-10-23 07:35:13 +04:00
++ jell
2014-10-22 06:59:05 +04:00
|= [a=bone b=term-line]
[a %give %rush %term-line b]
2014-10-02 23:46:00 +04:00
::
++ spam
2014-10-22 06:59:05 +04:00
|= [pax=path tel=term-line]
%+ murn
(~(tap by sup.hid))
|= [ost=bone @ paf=path]
2014-10-23 01:49:47 +04:00
?: =([%lines pax] paf)
2014-10-23 07:35:13 +04:00
(some (jell ost tel))
2014-10-22 06:59:05 +04:00
~
2014-10-02 23:46:00 +04:00
::
2014-09-12 06:11:03 +04:00
++ pour
2014-10-08 03:05:44 +04:00
|= [ost=bone pax=path sih=*]
2014-09-12 06:11:03 +04:00
^- [(list move) _+>]
2014-10-08 03:05:44 +04:00
=+ sih=((hard sign) sih)
2014-10-22 06:59:05 +04:00
?: ?=(?(%sage %veer %vega) &2.sih) :: vomit
2014-10-04 02:31:16 +04:00
[[ost %give +.sih]~ +>.$]
2014-10-22 23:13:07 +04:00
?~ pax !!
?+ -.pax !!
2014-10-23 01:49:47 +04:00
%fork ?>(?=(%gone +<.sih) `+>.$) :: XX maybe mean?
%resp
2014-10-22 23:13:07 +04:00
?+ +<.sih !!
2014-10-03 02:21:23 +04:00
%nice `+>.$
?(%rust %rush)
2014-10-22 23:13:07 +04:00
=+ tol=(fall (~(get by hiz) t.pax) *term-line)
2014-10-23 03:20:34 +04:00
=. p.q.sih ?^(q.q.sih p.tol (cat 3 p.q.sih '> ')) :: XX prompt hack
=. tol [p.q.sih (weld q.q.sih q.tol) (weld r.q.sih r.tol)]
2014-10-22 23:13:07 +04:00
=. hiz (~(put by hiz) t.pax tol)
[(spam t.pax q.sih) +>.$]
2014-10-03 02:21:23 +04:00
==
2014-10-22 23:13:07 +04:00
::
?(%txt %kyev)
?+ +<.sih !!
2014-10-23 03:20:34 +04:00
%nice [[ost %give +.sih]~ +>.$]
2014-10-22 23:13:07 +04:00
%mean
?< ?=(~ t.pax)
=+ tel=(fall (~(get by hiz) t.t.pax) *term-line)
=. r.tel
%- welp :_ r.tel
=- (turn - |=(a=tank rose/[~ "! " ~]^[a]~))
^- (list tank)
?~ p.sih ~
(welp q.u.p.sih leaf/(trip p.u.p.sih) ~)
=. hiz (~(put by hiz) t.t.pax tel)
[[[ost %give +.sih] (spam t.t.pax tel)] +>.$]
==
==
2014-09-12 06:11:03 +04:00
--