mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-17 03:44:34 +03:00
247 lines
7.1 KiB
Plaintext
247 lines
7.1 KiB
Plaintext
:: Terminal
|
|
::
|
|
:::: /hook/core/terminal/app
|
|
::
|
|
/? 314 :: need urbit 314
|
|
/- term-line
|
|
::
|
|
:::: structures
|
|
::
|
|
|% ::
|
|
++ axle $: %1 ::
|
|
hiz=(map path term-line) ::
|
|
== ::
|
|
++ gilt ::
|
|
$% [%term-line p=term-line] ::
|
|
[%hymn p=manx] ::
|
|
[%json p=json] ::
|
|
== ::
|
|
++ gift ::
|
|
$% [%rush gilt] ::
|
|
[%rust gilt] ::
|
|
[%mean p=ares] ::
|
|
[%nice ~] ::
|
|
== ::
|
|
++ hapt ,[p=ship q=path] ::
|
|
++ 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=[%txt vase]] ::
|
|
== == == ::
|
|
++ sign ::
|
|
$% $: %g ::
|
|
$% [%gone p=hapt] ::
|
|
[%mean p=ares] ::
|
|
[%nice ~] ::
|
|
== == ==
|
|
--
|
|
::
|
|
:::: libs
|
|
::
|
|
|%
|
|
++ 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)))
|
|
--
|
|
!:
|
|
:::: program
|
|
::
|
|
|_ [hid=hide axle]
|
|
++ page
|
|
|= pax=path
|
|
^- manx
|
|
;html
|
|
;head
|
|
;title: Hi
|
|
;script(src "/gen/main/lib/urb.js");
|
|
;script(src "//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js");
|
|
;script: urb.appl = "{(trip app.hid)}"
|
|
;script: urb.term = \{pax: "{(spud pax)}"}
|
|
;script:'''
|
|
jpok = function(a,b){
|
|
var dat = {pax:urb.term.pax, act:{}}
|
|
dat.act[a] = b
|
|
urb.send({data:dat})
|
|
}
|
|
'''
|
|
;style:'''
|
|
html {
|
|
font-size: 14px;
|
|
}
|
|
body {
|
|
margin: 2rem;
|
|
}
|
|
body,
|
|
span,
|
|
input {
|
|
font-family: monospace;
|
|
font-size: 1rem;
|
|
background-color: #000;
|
|
color: #fff;
|
|
}
|
|
button {
|
|
border: none;
|
|
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
font-weight: 600;
|
|
font-size: .8rem;
|
|
text-transform: uppercase;
|
|
letter-spacing: 1px;
|
|
color: #000;
|
|
background-color: #fff;
|
|
padding: 1rem;
|
|
}
|
|
input {
|
|
border: 0;
|
|
outline: none;
|
|
width: 90%;
|
|
}
|
|
'''
|
|
==
|
|
;body
|
|
;pre#cont;
|
|
;span#prem:">" ;input#prom;
|
|
;br;
|
|
;button(onclick "jpok('res', 'shell')"): Reboot
|
|
;script:'''
|
|
$(prom).keydown(function(e){
|
|
if(e.which != 13) return;
|
|
prem.textContent += prom.value
|
|
jpok('line', prom.value)
|
|
$(this).val('')
|
|
})
|
|
$(prom).focus()
|
|
$(prem).on('click', function() { $(prom).focus(); })
|
|
var pax = '/lines'
|
|
if(urb.term.pax != "/") pax += urb.term.pax
|
|
urb.subscribe({path: pax}, function(e, dat){
|
|
if(dat.data.ok) return;
|
|
cont.textContent = dat.data.lines.join('\n')
|
|
prem.textContent = dat.data.prompt + '> '
|
|
})
|
|
'''
|
|
==
|
|
==
|
|
::
|
|
++ peer
|
|
|= [ost=bone you=ship pax=path]
|
|
^- [(list move) _+>]
|
|
?~ pax
|
|
$(pax /term)
|
|
?+ -.pax !!
|
|
%lines
|
|
:_ +>.$
|
|
:_ ~
|
|
(jell ost t.pax)
|
|
%term
|
|
=+ tel=(fall (~(get by hiz) t.pax) *term-line)
|
|
=^ mof q.tel
|
|
=+ aut=%shell
|
|
?: (~(has by cub.hid) (encode aut t.pax))
|
|
[~ q.tel]
|
|
:- [ost %pass hi/mar/pax %g %sire [aut (encode aut t.pax)]]~
|
|
:_(q.tel leaf/"+ {(trip aut)}")
|
|
=. hiz (~(put by hiz) t.pax tel)
|
|
:_ +>.$
|
|
[[ost %give %rust %hymn (page t.pax)] mof]
|
|
==
|
|
::
|
|
++ poke-json
|
|
|= [ost=bone you=ship jon=json]
|
|
^- [(list move) _+>]
|
|
=+ ^- [pax=path jof=$%([%line p=span] [%res p=span])]
|
|
%- need
|
|
%. jon
|
|
(ot pax/(su ;~(pfix fas (more fas sym))) act/(of line/so res/so ~) ~):jo
|
|
=+ tel=(fall (~(get by hiz) pax) *term-line)
|
|
?- -.jof
|
|
%res
|
|
=^ mof q.tel
|
|
?. (~(has by cub.hid) (encode p.jof pax))
|
|
[~ q.tel]
|
|
:_ :_(q.tel leaf/"- {(trip p.jof)}")
|
|
[ost %pass hi/mar/pax %g %cide (encode p.jof pax)]~
|
|
::~& poke-sire/[jof cub.hid]
|
|
=. q.tel :_(q.tel leaf/"+ {(trip p.jof)}")
|
|
=. hiz (~(put by hiz) pax tel)
|
|
:_ +>.$
|
|
%+ welp mof
|
|
:+ [ost %give %nice ~]
|
|
[ost %pass hi/mar/pax %g %sire [p.jof (encode p.jof pax)]]
|
|
(spam pax)
|
|
::
|
|
%line
|
|
=. q.tel :_(q.tel leaf/"{(trip p.tel)}> {(trip p.jof)}")
|
|
=. hiz (~(put by hiz) pax tel)
|
|
:_ +>.$
|
|
%+ murn (~(tap by cub.hid))
|
|
|= [p=span q=term]
|
|
?. =(pax q:(decode p)) ~
|
|
%- some
|
|
[ost %pass [%txt p pax] %g %mess [our.hid p imp.hid] you %txt !>(p.jof)]
|
|
==
|
|
::
|
|
++ jell
|
|
|= [a=bone b=path]
|
|
[a %give %rust %json (tel-to-jon (fall (~(get by hiz) b) *term-line))]
|
|
::
|
|
++ spam
|
|
|= pax=path
|
|
%+ murn
|
|
(~(tap by sup.hid))
|
|
|= [ost=bone @ paf=path]
|
|
?. =([%lines pax] paf) ~
|
|
(some (jell ost pax))
|
|
::
|
|
++ poke-term-line
|
|
|= [ost=bone you=ship tel=term-line]
|
|
^- [(list move) _+>]
|
|
::~& tel-poke/tel
|
|
=| pax=path :: XX subscriptions
|
|
=+ tol=(fall (~(get by hiz) pax) *term-line)
|
|
=. tol [p.tel (weld q.tel q.tol)]
|
|
=. hiz (~(put by hiz) pax tol)
|
|
:_ +>.$
|
|
:- [ost %give %nice ~]
|
|
(spam pax)
|
|
::
|
|
++ pour
|
|
|= [ost=bone pax=path sih=sign]
|
|
^- [(list move) _+>]
|
|
?: ?=(%gone +<.sih)
|
|
`+>.$
|
|
=+ paf=|2.pax
|
|
=+ tel=(fall (~(get by hiz) paf) *term-line)
|
|
=+ old=tel
|
|
=. q.tel
|
|
?. ?=(%mean &2.sih) q.tel
|
|
=- %- welp :_ q.tel
|
|
%+ turn
|
|
(flop -)
|
|
|=(a=tank rose/[~ "! " ~]^[a]~)
|
|
^- (list tank)
|
|
?~ p.sih ~
|
|
:- leaf/(trip p.u.p.sih)
|
|
(flop q.u.p.sih)
|
|
=. hiz (~(put by hiz) paf tel)
|
|
:_ +>.$
|
|
:- [ost %give +.sih]
|
|
?:(=(old tel) ~ (spam paf))
|
|
::
|
|
++ tel-to-jon
|
|
|= tel=term-line
|
|
%- jobe
|
|
:~ [%prompt %s p.tel]
|
|
:+ %lines %a
|
|
%- turn :_ jape
|
|
^- wall %- zing
|
|
^- (list wall)
|
|
%- flop
|
|
(turn q.tel (cury wash 0 80))
|
|
==
|
|
--
|