mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-21 05:41:43 +03:00
307 lines
9.1 KiB
Plaintext
307 lines
9.1 KiB
Plaintext
:: Terminal
|
|
::
|
|
:::: /hook/core/terminal/app
|
|
::
|
|
/? 314 :: need urbit 314
|
|
/- term-line, term-in, term-ctrl, kyev
|
|
::/= stat /:/%%/:/hymn/
|
|
::
|
|
:::: structures
|
|
::
|
|
|% ::
|
|
++ axle $: %1 ::
|
|
hiz=(map path term-line) ::
|
|
== ::
|
|
++ gilt ::
|
|
$% [%term-line p=term-line] ::
|
|
[%hymn p=manx] ::
|
|
== ::
|
|
++ gift ::
|
|
$% [%rush 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) ::
|
|
++ 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 ::
|
|
$% $: %g ::
|
|
$% [%cide p=span] ::
|
|
[%show p=hapt q=ship r=path] ::
|
|
[%sire p=term q=span] ::
|
|
[%mess p=hapt q=ship r=mess] ::
|
|
[%took p=hapt q=ship] ::
|
|
== == == ::
|
|
++ sign ::
|
|
$% $: %g ::
|
|
$% [%gone p=hapt] ::
|
|
[%init p=@p] ::
|
|
[%logo @] ::
|
|
[%mean p=ares] ::
|
|
[%nice ~] ::
|
|
[%rush p=%term-line q=term-line] ::
|
|
[%sage p=path q=*] ::
|
|
[%verb ~] ::
|
|
[%veer p=@ta q=path r=@t] ::
|
|
[%vega p=path] ::
|
|
== == ==
|
|
--
|
|
::
|
|
:::: from future import wick, pack, pick XX remove on breach or kelvin bump
|
|
::
|
|
|%
|
|
++ wick :: span format
|
|
|= a=@
|
|
^- (unit ,@ta)
|
|
=+ b=(rip 3 a)
|
|
=- ?^(b ~ (some (rap 3 (flop c))))
|
|
=| c=tape
|
|
|- ^- [b=tape c=tape]
|
|
?~ b [~ c]
|
|
?. =('~' i.b)
|
|
$(b t.b, c [i.b c])
|
|
?~ t.b [b ~]
|
|
?- i.t.b
|
|
%'~' $(b t.t.b, c ['~' c])
|
|
%'-' $(b t.t.b, c ['_' c])
|
|
@ [b ~]
|
|
==
|
|
::
|
|
++ pack :: light path encoding
|
|
|= [a=term b=path] ^- span
|
|
%+ rap 3 :- (wack a)
|
|
(turn b |=(c=span (cat 3 '_' (wack c))))
|
|
::
|
|
++ pick :: light path decoding
|
|
|= a=span ^- (unit ,[p=term q=path])
|
|
(rush a (most cab (sear wick urt:ab)))
|
|
--
|
|
!:
|
|
:::: helpers
|
|
::
|
|
|%
|
|
++ aut %shell
|
|
++ 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]
|
|
%- flop
|
|
^- (list move)
|
|
=+ auc=(pack 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=(pack 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 [ost %give %rust %term-line tel] :: term-line output
|
|
==
|
|
==
|
|
::
|
|
++ poke
|
|
|= jof=$%([%line p=cord] [%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
|
|
(start-shell our.hid imp.hid ost you pax)
|
|
[ost %give %nice ~]~
|
|
(spam tel)
|
|
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 :_(mow [ost %give %rush %term-line [p q ~]:tel]))
|
|
::
|
|
++ pour
|
|
|= [dis=?(%fork %resp %txt %kyev %type) sih=sign]
|
|
^+ +>
|
|
?- dis
|
|
%fork ?>(?=(%gone +<.sih) +>.$) :: XX maybe mean?
|
|
%resp
|
|
?+ +<.sih !!
|
|
%nice +>.$
|
|
%rush
|
|
:: ~? !=(p.tel p.q.sih) prompt/[p.q.sih ?=(~ q.q.sih)]
|
|
=. p.q.sih ?^(q.q.sih p.tel p.q.sih) :: XX prompt hack
|
|
%_ +>.$
|
|
mow :- [ost %pass [%resp pax] %g %took [our.hid [auc imp.hid]] you]
|
|
(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]~))
|
|
%- flop ^- tang
|
|
?~ p.sih ~
|
|
[leaf/(trip p.u.p.sih) q.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]
|
|
?. =(p auc) ~
|
|
%- 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 tol)
|
|
~
|
|
--
|
|
--
|
|
!:
|
|
:::: 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=~|([%term-pour (,[term term ~] sih)] ((hard sign) sih))
|
|
?: ?=(?(%sage %init %logo %verb %veer %vega) &2.sih) :: vomit
|
|
[[ost %give +.sih]~ +>.$]
|
|
?~ pax !!
|
|
?. ?=(?(%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))
|
|
^- [(list move) _+>]
|
|
:- ~
|
|
%_ +>.$
|
|
hiz
|
|
?. ?=([~ ~ *] old) hiz
|
|
%- ~(run by hiz.u.u.old)
|
|
|=(term-line [p q ~])
|
|
==
|
|
--
|