shrub/main/app/terminal/core.hook

157 lines
4.7 KiB
Plaintext
Raw Normal View History

2014-09-12 06:11:03 +04:00
:: Terminal
::
:::: /hook/core/terminal/app
::
/? 314 :: need urbit 314
/- term-line
::
:::: structures
::
|% ::
++ axle $: %0 ::
hiz=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 ::
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] ::
[%mess p=hapt q=ship r=[%txt vase]] ::
== == == ::
++ 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-09-12 06:11:03 +04:00
== == ==
--
!:
:::: program
::
|_ [hid=hide axle]
++ page
^- manx
;html
;head
;title: Hi
2014-09-23 05:00:25 +04:00
;script(src "/gen/main/lib/urb.js");
2014-09-18 06:56:49 +04:00
;script(src "//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js");
2014-09-12 06:11:03 +04:00
;script: urb.appl = "{(trip app.hid)}"
2014-09-18 06:56:49 +04:00
;script:'''
jpok = function(a,b){
var dat = {}
dat[a] = b
urb.send({data:dat})
}
'''
;style:'''
2014-09-23 05:00:25 +04:00
body, body * {
2014-09-18 06:56:49 +04:00
background-color: black;
color: greenyellow;
2014-09-23 05:00:25 +04:00
border-color: #0f2;
2014-09-18 06:56:49 +04:00
}
'''
2014-09-12 06:11:03 +04:00
==
;body
2014-09-18 06:56:49 +04:00
;button(onclick "jpok('new', 'shell')"): Boot
2014-09-23 02:20:47 +04:00
;button(onclick "jpok('del', 'shell')"): unBoot
2014-09-18 06:56:49 +04:00
;pre#cont;
;span#prem:">" ;input#prom;
;script:'''
$(prom).keydown(function(e){
if(e.which != 13) return;
prem.textContent += prom.value
jpok('line', prom.value)
$(this).val('')
})
2014-09-23 05:00:25 +04:00
$(prom).focus()
2014-09-18 06:56:49 +04:00
urb.subscribe({path: '/lines'}, function(e, dat){
if(dat.data.ok) return;
cont.textContent = dat.data.lines.join('\n')
prem.textContent = dat.data.prompt + '> '
})
'''
2014-09-12 06:11:03 +04:00
==
==
::
++ peer
|= [ost=bone you=ship pax=path]
^- [(list move) _+>]
:_ +>.$ :_ ~
?~ pax
[ost %give %rust %hymn page]
?+ -.pax !!
2014-09-18 06:56:49 +04:00
%lines (jell ost)
2014-09-12 06:11:03 +04:00
==
::
++ poke-json
|= [ost=bone you=ship jon=json]
^- [(list move) _+>]
2014-09-23 02:20:47 +04:00
=+ jof=(need ((of line/so new/so del/so ~):jo jon))
2014-09-12 06:11:03 +04:00
?- -.jof
2014-09-23 02:20:47 +04:00
%del
=. q.hiz :_(q.hiz leaf/"- {(trip +.jof)}")
:_ +>.$
:+ [ost %give %mean ~ %hey ~]
[ost %pass /hi %g %cide +.jof]
(turn (~(tap in (~(get ju pus.hid) /lines))) jell)
::
2014-09-12 06:11:03 +04:00
%new
~& poke-sire/jof
2014-09-18 06:56:49 +04:00
=. q.hiz :_(q.hiz leaf/"+ {(trip +.jof)}")
:_ +>.$
:+ [ost %give %nice ~]
2014-09-23 02:20:47 +04:00
[ost %pass /hi %g %sire [+ +]:jof]
2014-09-18 06:56:49 +04:00
(turn (~(tap in (~(get ju pus.hid) /lines))) jell)
2014-09-23 02:20:47 +04:00
::
2014-09-12 06:11:03 +04:00
%line
2014-09-18 06:56:49 +04:00
=. q.hiz :_(q.hiz leaf/"{(trip p.hiz)}> {(trip +.jof)}")
:_ +>.$
2014-09-12 06:11:03 +04:00
%+ turn (~(tap by cub.hid))
|= [p=span q=term]
[ost %pass /txt/[p] %g %mess [our.hid p imp.hid] you %txt !>(+.jof)]
==
::
2014-09-18 06:56:49 +04:00
++ jell |=(a=bone [a %give %rust %json (tel-to-jon hiz)])
2014-09-12 06:11:03 +04:00
++ poke-term-line
|= [ost=bone you=ship tel=term-line]
^- [(list move) _+>]
=. hiz [p.tel (weld q.tel q.hiz)]
:_ +>.$
:- [ost %give %nice ~]
2014-09-18 06:56:49 +04:00
(turn (~(tap in (~(get ju pus.hid) /lines))) jell)
2014-09-12 06:11:03 +04:00
::
++ pour
2014-09-18 06:56:49 +04:00
|= [ost=bone pax=path sih=sign]
2014-09-12 06:11:03 +04:00
^- [(list move) _+>]
2014-09-23 02:20:47 +04:00
?: ?=(%gone +<.sih)
`+>.$
2014-09-12 06:11:03 +04:00
:_ +>.$
[ost %give +.sih]~
::
++ 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))
==
--