mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-18 04:11:49 +03:00
319 lines
9.9 KiB
Plaintext
319 lines
9.9 KiB
Plaintext
:: Terminal
|
|
::
|
|
:::: /hook/core/terminal/app
|
|
::
|
|
/? 314 :: need urbit 314
|
|
/- term-line, term-in, term-ctrl, kyev
|
|
::/= stat /:/%%/:/hymn/
|
|
::
|
|
:::: structures
|
|
::
|
|
!:
|
|
|% ::
|
|
++ axle ,[%2 axle-2] ::
|
|
++ axle-any ::
|
|
$% [%1 axle-1] ::
|
|
[%2 axle-2] ::
|
|
== ::
|
|
++ axle-2 $=(hiz (map path term-line)) ::
|
|
++ axle-1 (map path old-term-line) ::
|
|
++ old-term-line ::
|
|
$: p=[p=cord q=prom r=cord] ::
|
|
q=(list cord) ::
|
|
r=(list ?(tank [%stem p=tank q=tank])) ::
|
|
== ::
|
|
++ gilt ::
|
|
$% [%term-line p=old-term-line] ::
|
|
[%term-line-2 p=term-line] ::
|
|
[%hymn p=manx] ::
|
|
== ::
|
|
++ gift ::
|
|
$% [%rush gilt] ::
|
|
[%rust gilt] ::
|
|
[%init p=@p] ::
|
|
[%logo @] ::
|
|
[%mean p=ares] ::
|
|
[%nice ~] ::
|
|
[%sage p=path q=*] ::
|
|
[%verb ~] ::
|
|
[%veer p=@ta q=path r=@t] ::
|
|
[%vega p=path] ::
|
|
== ::
|
|
++ glas ?(%term %lines %lines-2) ::
|
|
++ hapt ,[p=ship q=path] ::
|
|
++ mess ::
|
|
$% [%txt p=(hypo cord)] ::
|
|
[%kyev p=(hypo kyev)] ::
|
|
[%type p=(hypo ,?)] ::
|
|
== ::
|
|
++ move ,[p=bone q=(mold note gift)] ::
|
|
++ note ::
|
|
$% $: %c ::
|
|
$% [%info p=@p q=@tas r=nori] ::
|
|
== == ::
|
|
$: %g ::
|
|
$% [%cide p=span] ::
|
|
[%show p=hapt q=ship r=path] ::
|
|
[%sire p=term q=span] ::
|
|
[%mess p=hapt q=ship r=mess] ::
|
|
== == == ::
|
|
++ sign ::
|
|
$% $: %g ::
|
|
$% [%gone p=hapt] ::
|
|
[%init p=@p] ::
|
|
[%logo @] ::
|
|
[%mean p=ares] ::
|
|
[%nice ~] ::
|
|
[%rust p=%term-line q=term-line] ::
|
|
[%rush p=%term-line q=term-line] ::
|
|
[%sage p=path q=*] ::
|
|
[%verb ~] ::
|
|
[%veer p=@ta q=path r=@t] ::
|
|
[%vega p=path] ::
|
|
== == ==
|
|
--
|
|
!:
|
|
:::: helpers
|
|
::
|
|
|%
|
|
++ 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)))
|
|
++ 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)))
|
|
::
|
|
++ start-shell
|
|
|= [our=ship imp=path ost=bone you=ship pax=path]
|
|
^- (list move)
|
|
=+ auc=(encode aut pax)
|
|
:- [ost %pass [%fork pax] %g %sire [aut auc]]
|
|
[ost %pass [%resp pax] %g %show [our [auc imp]] you /out]~
|
|
--
|
|
!:
|
|
:::: per shell
|
|
::
|
|
|%
|
|
++ se
|
|
|= [hid=hide ost=bone you=ship hiz=(map path term-line) pax=path]
|
|
=+ tel=(fall (~(get by hiz) pax) *term-line)
|
|
=+ auc=(encode aut pax)
|
|
=^ mow tel
|
|
?: (~(has by cub.hid) auc)
|
|
[~ tel]
|
|
:- (start-shell our.hid imp.hid ost you pax)
|
|
tel(r :_(r.tel leaf/"+ {(trip aut)}"))
|
|
|%
|
|
++ abet
|
|
^- [(list move) (map path term-line)]
|
|
[(flop mow) (~(put by hiz) pax tel)]
|
|
::
|
|
++ page
|
|
;html
|
|
;head
|
|
;title: Not yet
|
|
==
|
|
;body;
|
|
==
|
|
:: %. stat
|
|
:: %+ inject
|
|
:: ~[%html %head]
|
|
:: ;= ;script: urb.appl = "{(trip app.hid)}"
|
|
:: ;script: urb.term = \{pax: "{(spud pax)}"}
|
|
:: ==
|
|
::
|
|
++ peer
|
|
|= gal=glas
|
|
%_ +>.$
|
|
mow
|
|
:_ mow
|
|
?- gal
|
|
%term [ost %give %rust %hymn page] :: hymn front end
|
|
%lines-2 [ost %give %rust %term-line-2 tel] :: term-line output
|
|
%lines [ost %give %rust %term-line (term-line-to-old-term-line tel)]
|
|
==
|
|
==
|
|
::
|
|
++ poke
|
|
|= jof=$%([%line p=span] [%res p=span] [%cmd p=char] [%type p=?])
|
|
^+ +>
|
|
?- -.jof
|
|
%res :: restart shell
|
|
=. +>.$
|
|
?. (~(has by cub.hid) auc) +>.$
|
|
%_ +>.$
|
|
mow :_(mow [ost %pass [%fork pax] %g %cide auc])
|
|
r.tel :_(r.tel leaf/"- {(trip aut)}")
|
|
==
|
|
%_ +>.$
|
|
r.tel :_(r.tel leaf/"+ {(trip auc)}")
|
|
mow
|
|
;: welp
|
|
(spam tel)
|
|
[ost %give %nice ~]~
|
|
(start-shell our.hid imp.hid ost you pax)
|
|
mow
|
|
==
|
|
==
|
|
::
|
|
%line :: command entered
|
|
=+ new=stem/[lat.hid leaf/(trip p.p.tel) leaf/(trip p.jof)]
|
|
=. r.tel
|
|
:_ r.tel
|
|
stem/[lat.hid leaf/(trip p.p.tel) leaf/(trip p.jof)]
|
|
=. +>.$ (send %txt -:!>(*cord) p.jof)
|
|
+>.$(mow (welp (spam p.tel q.tel new ~) mow))
|
|
::
|
|
%cmd :: key command
|
|
?+ p.jof
|
|
(send %kyev -:!>(*kyev) [[%ctrl ~ ~] p.jof])
|
|
%r $(jof [%res 'shell'])
|
|
==
|
|
::
|
|
%type
|
|
(send %type -:!>(*?) p.jof)
|
|
==
|
|
::
|
|
++ poke-ctrl
|
|
.(mow (welp (spam [p q ~]:tel) mow))
|
|
::
|
|
++ pour
|
|
|= [dis=?(%fork %resp %txt %kyev %type) sih=sign]
|
|
^+ +>
|
|
?- dis
|
|
%fork ?>(?=(%gone +<.sih) +>.$) :: XX maybe mean?
|
|
%resp
|
|
?+ +<.sih !!
|
|
%nice +>.$
|
|
?(%rust %rush)
|
|
=. p.q.sih ?^(q.q.sih p.tel p.q.sih) :: XX prompt hack
|
|
%_ +>.$
|
|
mow (welp (spam q.sih) mow)
|
|
tel [p.q.sih (weld q.q.sih q.tel) (weld r.q.sih r.tel)]
|
|
==
|
|
==
|
|
::
|
|
?(%txt %kyev %type)
|
|
?+ +<.sih !!
|
|
%nice +>.$(mow :_(mow [ost %give +.sih]))
|
|
%mean
|
|
=+ ^= new
|
|
=- (turn - |=(a=tank rose/[~ "! " ~]^[a]~))
|
|
^- (list tank)
|
|
?~ p.sih ~
|
|
(welp q.u.p.sih leaf/(trip p.u.p.sih) ~)
|
|
%_ +>.$
|
|
r.tel (welp new r.tel)
|
|
mow
|
|
%- welp :_ mow
|
|
[[ost %give +.sih] (spam [p.tel q.tel new])]
|
|
==
|
|
==
|
|
==
|
|
::
|
|
++ send
|
|
|= mez=mess
|
|
%_ +>.$
|
|
mow
|
|
%- welp :_ mow
|
|
^- (list move)
|
|
%+ murn (~(tap by cub.hid))
|
|
|= [p=span q=term]
|
|
?. =(pax q:(decode p)) ~
|
|
%- some ^- move
|
|
:^ ost %pass [-.mez pax]
|
|
[%g %mess [our.hid p imp.hid] you mez]
|
|
==
|
|
::
|
|
++ spam
|
|
|= tol=term-line
|
|
^- (list move)
|
|
%+ murn
|
|
(~(tap by sup.hid))
|
|
|= [ost=bone @ paf=path]
|
|
?: =([%lines pax] paf)
|
|
(some ost %give %rush %term-line (term-line-to-old-term-line tol))
|
|
?: =([%lines-2 pax] paf)
|
|
(some ost %give %rush %term-line-2 tol)
|
|
~
|
|
::
|
|
++ term-line-to-old-term-line
|
|
|= term-line
|
|
^- old-term-line
|
|
:+ p q
|
|
%+ turn r
|
|
|=(?(tank [%stem p=@da q=tank r=tank]) ?.(?=(%stem +<-) +< [%stem q r]))
|
|
--
|
|
--
|
|
!:
|
|
:::: formal interface
|
|
::
|
|
|_ [hid=hide axle]
|
|
++ peer
|
|
|= [ost=bone you=ship pax=path]
|
|
^- [(list move) _+>]
|
|
?~ pax
|
|
$(pax /term)
|
|
?. ?=(glas i.pax)
|
|
[[ost %give %mean ~ %bad-path ~]~ +>.$]
|
|
=+ abet:(peer:(se hid ost you hiz t.pax) i.pax)
|
|
[-< +>.$(hiz ->)]
|
|
::
|
|
++ poke-term-in
|
|
|= [ost=bone you=ship term-in]
|
|
^- [(list move) _+>]
|
|
=+ abet:(poke:(se hid ost you hiz pax) jof)
|
|
[-< +>.$(hiz ->)]
|
|
::
|
|
++ poke-term-ctrl
|
|
|= [ost=bone you=ship col=term-ctrl]
|
|
^- [(list move) _+>]
|
|
=+ abet:poke-ctrl:(se hid ost you hiz /)
|
|
[-< +>.$(hiz ->)]
|
|
::
|
|
++ pour
|
|
|= [ost=bone pax=path sih=*]
|
|
^- [(list move) _+>]
|
|
=+ sih=((hard sign) sih)
|
|
?: ?=(?(%sage %init %logo %verb %veer %vega) &2.sih) :: vomit
|
|
[[ost %give +.sih]~ +>.$]
|
|
?~ pax ~& %terminal-bad-path [~ +>.$]
|
|
?. ?=(?(%fork %resp %txt %kyev %type) i.pax) !!
|
|
=+ abet:(pour:(se hid ost our.hid hiz t.pax) i.pax sih)
|
|
[-< +>.$(hiz ->)]
|
|
::
|
|
++ prep
|
|
|= old=(unit (unit axle-any))
|
|
^- [(list move) _+>]
|
|
=+ pax=|=(@tas [(scot %p our.hid) %arvo (scot %da lat.hid) +< %hoon ~])
|
|
:- :~ [0 %give %veer %d (pax %dill) (,@ .^(%cx (pax %dill)))]
|
|
==
|
|
=< %_(. hiz (~(run by hiz) |=(term-line [p q ~])))
|
|
?> ?=(^ old)
|
|
?~ u.old
|
|
+>.$
|
|
|-
|
|
?- -.u.u.old
|
|
%2 %_(+>.^$ +<+ u.u.old)
|
|
%1 $(u.u.old [%2 (axle-1-to-axle-2 +.u.u.old)])
|
|
==
|
|
::
|
|
++ axle-1-to-axle-2
|
|
|= vat=axle-1
|
|
^- axle-2
|
|
%- ~(run by vat)
|
|
|= old-term-line
|
|
^- term-line
|
|
:+ p q
|
|
%+ turn r
|
|
|=(?(tank [%stem p=tank q=tank]) ?.(?=(%stem +<-) +< [%stem *@da p q]))
|
|
--
|