basic terminal and shell apps

This commit is contained in:
Ubuntu 2014-09-12 02:11:03 +00:00
parent c2e05b0e2f
commit c14d6b4d05
8 changed files with 262 additions and 14 deletions

View File

@ -1,4 +1,4 @@
!: :: %gall, user-level applications
:: :: %gall, user-level applications
!? 164
::::
|= pit=vase
@ -33,6 +33,7 @@
== ::
++ knob :: pending action
$% [%boot ~] :: begin boot
[%cide p=span] :: subprocessicide
[%crud p=@tas q=(list tank)] :: error
[%load p=cage] :: continue boot
[%mess p=ship q=cage] :: typed message
@ -103,6 +104,7 @@
act=@ud :: action number
lat=@da :: last change
orm=(unit ,@da) :: build date
cub=(map span term) :: offspring
sup=(map bone (pair ship path)) :: subscribers
pus=(jug path bone) :: srebircsbus
peq=(map bone ,@uvI) :: peekers
@ -184,12 +186,21 @@
:- ?~(p.u.a ~ ?~(p.u.b ~ `(grom u.p.u.b u.p.u.a)))
(grom q.u.b q.u.a)
::
++ lamp
|= con=(unit coin)
^- (unit path)
?. ?=([~ %many *] con) ~
%- zl:jo
%+ turn p.u.con
|= tem=coin
?.(?=([%$ %ta @] tem) ~ (some q.p.tem))
::
++ lump :: position
|= pax=path
^- [p=hapt q=path]
?> ?=([@ @ *] pax)
:- :- (slav %p i.pax)
((hard path) (cue (slav %uw i.t.pax)))
(need (lamp (slay i.t.pax)))
t.t.pax
--
. == :: end preface
@ -486,7 +497,8 @@
::
++ away :: application path
|= pax=path ^- path
[%a (scot %p our) (scot %uw (jam imp)) pax]
=+ imc=[%many (turn imp |=(a=span [%$ %ta a]))]
[%a (scot %p our) ~(rent co imc) pax]
::
++ bear :: write backward
|= hen=duct
@ -601,7 +613,7 @@
:+ %mute kas
:_ ~
:- [%$ 12]~
(cave !>([[our app.sat imp] sup.sat pus.sat [act.sat eny now]]))
(cave !>([[our app.sat imp] cub.sat sup.sat pus.sat [act.sat eny now]]))
++ core |=(vax=vase (cove %core vax)) :: core as silk
++ cove :: cage as silk
|= cay=cage
@ -623,6 +635,13 @@
[%show q.i.pys]
==
::
++ deff
|= [wir=wire hon=duct caq=vase]
^- toil
?> ?=([%pass p=* q=%g r=[p=%cide q=span]] q.caq)
:: [[[%g wir] hon] r.q.caq]
[hon r.q.caq]
::
++ drug :: set dependencies
|= pen=(set (pair ship desk))
:: ~& [%drug %pen pen]
@ -909,6 +928,7 @@
[%pass p=* q=@tas r=[p=@tas q=*]]
=+ wir=(away %u ((hard path) p.q.caq))
?: ?=(%sire p.r.q.caq) [%| (birf wir hon caq)]
?: ?=(%cide p.r.q.caq) [%| (deff wir hon caq)]
:+ %& hon
:^ %pass wir
(need ((sand %tas) ((hard ,@) q.q.caq)))
@ -957,6 +977,15 @@
?. (warm %park)
[%done ~ %$ (slot 13 u.huv.sat)]
(harm %park (conf (core u.huv.sat)))
::
%cide
?. (~(has by bum.mat) [p.kon imp])
~& %cide-missed +>.$(qic.sat ~)
%_ +>.$
bum.mat (~(del by bum.mat) [p.kon imp])
cub.sat (~(del by cub.sat) p.kon)
qic.sat ~
==
::
%load
=+ [hom=(slot 2 q.p.kon) old=(slot 3 q.p.kon)]
@ -1005,10 +1034,12 @@
(give(qic.sat ~) %dumb ~)
::
%sire
=. qic.sat ~
?: (~(has by bum.mat) [q.kon imp])
~& %sire-redundant +>.$
=. bum.mat
~& %sire-redundant +>.$(qic.sat ~)
%_ +>.$
cub.sat (~(put by cub.sat) q.kon p.kon)
qic.sat ~
bum.mat
%+ ~(put by bum.mat) [q.kon imp]
%* . *seat
app p.kon
@ -1018,7 +1049,7 @@
[[hun.mat 0 ~] ~ ~]
[[0 hun.mat] ~ ~]
==
+>.$
==
::
%take
?. (warm %pour)

View File

@ -9579,6 +9579,7 @@
app=term :: app identity
imp=path :: app instance
== ::
cub=(map span term) :: offspring
sup=(map bone (pair ship path)) :: subscription set
pus=(jug path bone) :: noitpircsbus set
$: act=@ud :: change number

46
main/app/shell/core.hook Normal file
View File

@ -0,0 +1,46 @@
:: Terminal
::
:::: /hook/core/terminal/app
::
/? 314
/- term-line
::
:::: structures
::
|% ::
++ gift ::
$% [%mean p=ares] ::
[%nice ~] ::
== ::
++ hapt ,[p=ship q=path] ::
++ move ,[p=bone q=(mold note gift)] ::
++ note ::
$% $: %g ::
$% [%show p=hapt q=ship r=path] ::
[%mess p=hapt q=ship r=[%term-line vase]] ::
== == == ::
++ sign ::
$% $: %g ::
$% [%nice ~] ::
[%mean p=ares] ::
== == == ::
--
!:
:::: program
::
|_ [hid=hide ~]
++ poke-txt
|= [ost=bone you=ship txt=cord]
^- [(list move) _+>]
:_ +>.$ :_ ~
:* ost %pass / %g %mess
[our.hid +.imp.hid] you
%term-line !>(`term-line`[(crip <lat.hid>) leaf/(trip txt) ~])
==
::
++ pour
|= [ost=bone pax=path sih=sign]
^- [(list move) _+>]
:_ +>.$
[ost %give +.sih]~
--

118
main/app/terminal/core.hook Normal file
View File

@ -0,0 +1,118 @@
:: 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 ::
$% [%show p=hapt q=ship r=path] ::
[%sire p=term q=span] ::
[%mess p=hapt q=ship r=[%txt vase]] ::
== == == ::
++ sign ::
$% $: %g ::
$% [%nice ~] ::
[%mean p=ares] ::
== == ==
--
!:
:::: program
::
|_ [hid=hide axle]
++ page
^- manx
=+ jpok=|=([a=term b=cord] "urb.send(\{data: \{{(trip a)}:{(trip b)}}})")
;html
;head
;title: Hi
;script(src "/gon/main/lib/urb.js");
;script: urb.appl = "{(trip app.hid)}"
==
;body
;p: Hello
;button(onclick (jpok %new '"shell"')): Boot
;input#prom; ;button(onclick (jpok %line 'prom.value')): Set
;pre#cont; ;script:'''
urb.subscribe({path: '/lines'}, function(e, dat){
if(dat.data.ok) return;
cont.textContent = JSON.stringify(dat.data)
})
'''
==
==
::
++ peer
|= [ost=bone you=ship pax=path]
^- [(list move) _+>]
:_ +>.$ :_ ~
?~ pax
[ost %give %rust %hymn page]
?+ -.pax !!
%lines [ost %give %rust %json (tel-to-jon hiz)]
==
::
++ poke-json
|= [ost=bone you=ship jon=json]
^- [(list move) _+>]
:_ +>.$
=+ jof=(need ((of line/so new/so ~):jo jon))
?- -.jof
%new
~& poke-sire/jof
:- [ost %give %nice ~]
[ost %pass /hi %g %sire [+ +]:jof]~
%line
%+ turn (~(tap by cub.hid))
|= [p=span q=term]
[ost %pass /txt/[p] %g %mess [our.hid p imp.hid] you %txt !>(+.jof)]
==
::
++ poke-term-line
|= [ost=bone you=ship tel=term-line]
^- [(list move) _+>]
=. hiz [p.tel (weld q.tel q.hiz)]
:_ +>.$
:- [ost %give %nice ~]
%+ turn (~(tap in (~(get ju pus.hid) /lines)))
|= a=bone
[a %give %rush %json (tel-to-jon tel)]
::
++ pour
|= [ost=bone you=ship sih=sign]
^- [(list move) _+>]
:_ +>.$
[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))
==
--

View File

@ -32,6 +32,7 @@
++ note :: system request
$% $: %g :: to %gall
$% [%mess p=hapt q=ship r=cage] ::
[%cide p=span] ::
[%show p=hapt q=ship r=path] ::
[%sire p=term q=span] ::
== == == ::
@ -69,6 +70,30 @@
^- [(list move) _+>]
!!
--
++ cide
^- test
=> |%
++ sign
$% $: %g
$% [%nice ~]
[%rust %hymn p=manx]
== == ==
--
|%
++ poke
|+ [ost=bone you=ship]
^- [(list move) _+>]
~& [%cide-poke cub.hid sup.hid our.hid]
:_ +>.$
:~
[ost %pass /cide/hi %g %cide %baby]
[ost %give %nice ~]
==
++ pour
|+ [ost=bone pax=path sih=*]
^- [(list move) _+>]
!!
--
++ sire
^- test
=> |%
@ -86,12 +111,6 @@
:~
[ost %pass /sire/hi %g %sire %demo %baby]
[ost %pass /sire/ho %g %mess our.hid^baby/imp.hid you %json !>(*json)]
[ost %pass /sire/ho %g %mess our.hid^baby/imp.hid you %json !>(*json)]
[ost %pass /sire/ho %g %mess our.hid^baby/imp.hid you %json !>(*json)]
[ost %pass /sire/ho %g %mess our.hid^baby/imp.hid you %json !>(*json)]
[ost %pass /sire/ho %g %mess our.hid^baby/imp.hid you %json !>(*json)]
[ost %pass /sire/ho %g %mess our.hid^baby/imp.hid you %json !>(*json)]
[ost %pass /sire/ho %g %mess our.hid^baby/imp.hid you %json !>(*json)]
[ost %pass /sire/ho %g %show our.hid^baby/imp.hid you /]
==
++ pour
@ -230,6 +249,7 @@
=> et
:~ [%succeed succeed]
[%sire sire]
[%cide cide]
[%ze ze]
[%poke-local poke-local]
==
@ -238,6 +258,7 @@
++ peer :: accept subscriber
|= [ost=bone you=ship pax=path]
^- [(list move) _+>]
~& [%test-peer hid]
?~ pax [[ost %give %rust %hymn front]~ +>.$]
?: ?=(%tests -.pax)
[[ost %give %rust %json tests-json:et]~ +>.$]
@ -249,6 +270,7 @@
++ poke-json :: browser message
|= [ost=bone you=ship jon=json]
^- [(list move) _+>]
~& [%test-poke hid]
=+ tes=((of [%test so] ~):jo jon)
?~ tes [[ost %give %mean ~ %strange-json ~]~ +>.$]
=+ tst=(~(get by tests) +.u.tes)

View File

@ -0,0 +1,15 @@
::
:::: /hook/door/term-line/mar
::
/? 314
/- term-line
|_ tel=term-line
::
++ grab :: convert from
|%
++ noun :: convert from %noun
|= src=*
^+ +>+
+>+(tel (term-line src))
--
--

14
main/mar/txt/door.hook Normal file
View File

@ -0,0 +1,14 @@
::
:::: /hook/door/term-line/mar
::
/? 314
|_ txt=cord
::
++ grab :: convert from
|%
++ noun :: convert from %noun
|= src=*
^+ +>+
+>+(txt (cord src))
--
--

View File

@ -0,0 +1 @@
,[p=cord q=(list tank)]