shrub/main/app/shell/core.hook

324 lines
9.9 KiB
Plaintext
Raw Normal View History

2014-09-26 04:10:17 +04:00
:: Shell
2014-09-12 06:11:03 +04:00
::
2014-09-26 04:10:17 +04:00
:::: /hook/core/shell/app
2014-09-12 06:11:03 +04:00
::
/? 314
/- term-line
2014-09-26 04:10:17 +04:00
/= seeb /~ !>(.)
2014-09-12 06:11:03 +04:00
::
:::: structures
::
|% ::
++ gift ::
$% [%rush p=gilt] ::
2014-09-27 05:01:17 +04:00
[%mean p=ares] ::
2014-09-12 06:11:03 +04:00
[%nice ~] ::
2014-10-01 01:53:37 +04:00
[%meta p=vase] ::
2014-10-04 02:31:16 +04:00
[%veer p=@ta q=path r=@t] ::
[%vega p=path] ::
2014-09-12 06:11:03 +04:00
== ::
++ gilt ::
$% [%term-line p=term-line] ::
[%txt p=cord] ::
== ::
2014-09-12 06:11:03 +04:00
++ 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] ::
[%sire p=term q=span] ::
2014-09-23 05:00:25 +04:00
[%mess p=hapt q=ship r=cage] ::
2014-09-25 04:37:29 +04:00
[%meta p=vase] ::
2014-09-12 06:11:03 +04:00
== == == ::
2014-10-04 05:05:44 +04:00
++ mand ,[p=term q=(list twig)] ::
2014-10-08 03:05:44 +04:00
++ pipa ::
$% [%pipe p=mand q=pipa] ::
[%start mand] ::
== ::
2014-09-23 05:00:25 +04:00
++ coma ::
2014-10-08 03:05:44 +04:00
$? pipa ::
2014-10-01 04:29:32 +04:00
[%end p=(each ,@u cord)] ::
2014-09-23 05:00:25 +04:00
[%path p=path] ::
2014-09-25 04:37:29 +04:00
[%hoon p=twig] ::
2014-10-02 04:42:59 +04:00
[%var p=term q=twig] ::
2014-10-02 04:46:24 +04:00
[%rvar p=term] ::
2014-09-23 05:00:25 +04:00
== ::
2014-09-12 06:11:03 +04:00
++ 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-26 04:54:51 +04:00
[%rush p=mark q=*] ::
[%rust p=mark q=*] ::
2014-10-04 02:31:16 +04:00
[%veer p=@ta q=path r=@t] ::
[%vega p=path] ::
2014-09-12 06:11:03 +04:00
== == == ::
--
!:
:::: program
::
2014-10-01 01:53:37 +04:00
|_ $: hid=hide
pid=@u
pax=_`path`/=try=
act=(unit span)
pip=(map span span)
pop=(map span span)
2014-10-02 04:42:59 +04:00
var=(map term vase)
2014-10-01 01:53:37 +04:00
==
2014-09-23 05:00:25 +04:00
++ maybe
|* fel=_rule
;~ pose
2014-10-03 03:35:07 +04:00
fel
2014-09-23 05:00:25 +04:00
(easy ~)
==
::
++ args
2014-10-08 03:05:44 +04:00
:: ^- $+(nail (like (list twig)))
(more ace wide:(vang & pax))
2014-10-01 01:53:37 +04:00
::
++ pipe
2014-10-08 03:05:44 +04:00
%+ knee *[mand pipa] |. ~+
2014-10-04 05:05:44 +04:00
;~ pfix bar
2014-10-08 03:05:44 +04:00
;~ plug
;~(plug sym (maybe (ifix [;~(plug ace sel) ser] args)))
;~(pfix ace pipable)
==
==
::
++ pipable
%+ knee *pipa |. ~+
;~ pose
(stag %start ;~(pfix col ;~(plug sym (maybe ;~(pfix ace args)))))
(stag %pipe pipe)
2014-10-01 01:53:37 +04:00
==
2014-09-23 05:00:25 +04:00
::
2014-09-23 02:20:47 +04:00
++ parse
2014-09-23 05:00:25 +04:00
^- $+(nail (like coma))
2014-09-25 04:37:29 +04:00
=+ paf=?.(=('0' &3.pax) pax pax(&3 (scot da/lat.hid)))
2014-09-23 02:20:47 +04:00
;~ pose
2014-10-08 03:05:44 +04:00
pipable(pax paf)
2014-10-01 04:29:32 +04:00
(stag %end ;~(pfix sem ;~(pose (stag %& dem) (stag %| sym))))
2014-10-01 01:07:40 +04:00
(stag %path (sear plex rood):(vang & pax))
2014-10-02 04:42:59 +04:00
(stag %var ;~(plug ;~(pfix tis sym) ;~(pfix ace tall:(vang & paf))))
2014-10-02 04:46:24 +04:00
(stag %rvar ;~(pfix ;~(plug tis tis) sym))
(stag %hoon tall:(vang & paf))
2014-09-23 02:20:47 +04:00
==
::
2014-09-27 05:01:17 +04:00
++ peer
|= [ost=bone you=ship pax=path]
^- [(list move) _+>]
?~ pax `+>.$
?+ i.pax `+>.$
2014-10-03 02:21:23 +04:00
%in :: to app
2014-09-27 05:01:17 +04:00
?~ t.pax `+>.$
?. (~(has by cub.hid) i.t.pax) `+>.$
2014-10-01 01:53:37 +04:00
?: (~(has by pop) i.t.pax) `+>.$
2014-09-27 05:01:17 +04:00
:_ +>.$(act `i.t.pax)
2014-10-03 02:21:23 +04:00
(print ost you ~)
%out :: to terminal
?> ?=(~ t.pax)
2014-10-08 02:38:15 +04:00
:_ +>.$
[ost %give %rush %term-line `term-line`[prompt ~ ~]]~
2014-09-27 05:01:17 +04:00
==
::
2014-10-01 04:29:32 +04:00
++ cubs
%- sort :_ |=([a=span b=span] (lth (slav %ud a) (slav %ud b)))
^- (list span)
%+ murn (~(tap by sup.hid))
|= [@ @ a=path]
?. ?=([%in cord ~] a) ~
?. (~(has by cub.hid) i.t.a) ~
(some i.t.a)
::
2014-09-12 06:11:03 +04:00
++ poke-txt
|= [ost=bone you=ship txt=cord]
^- [(list move) _+>]
2014-10-08 03:05:44 +04:00
=| inp=(unit span)
2014-09-27 05:01:17 +04:00
?: =('\\' (end 3 1 txt))
?+ (rsh 3 1 txt)
:_ +>.$
2014-10-03 02:21:23 +04:00
:- [ost %give %nice ~]
(print ost you leaf/"no command {(trip txt)}" ~)
2014-10-01 04:29:32 +04:00
%x =. act
=+ ^= opt
:- i=`(unit span)`~
t=(turn cubs |=(a=span `(unit span)`[~ a]))
|-
?~ t.opt ~
?: =(act i.opt)
i.t.opt
$(opt t.opt)
2014-09-27 05:01:17 +04:00
:_ +>.$
2014-10-03 02:21:23 +04:00
:- [ost %give %nice ~]
(print ost you ~)
2014-10-01 04:29:32 +04:00
%l =+ =- tak=rose/[" " "[" "]"]^(turn cubs -)
|= a=span
leaf/(trip (rap 3 (~(got by cub.hid) a) '(' a ')' ~))
2014-10-03 02:21:23 +04:00
[[[ost give/nice/~] (print ost you tak ~)] +>.$]
2014-09-27 05:01:17 +04:00
==
?^ act
:_ +>.$
:- [ost %give %nice ~]
(spam /in/[u.act] %rush %txt txt)
2014-10-03 03:00:57 +04:00
::
=- :_ con
%+ welp (stash ost you txt)
2014-10-03 03:00:57 +04:00
?~ tak
mof
%+ welp
(print ost you tak ~)
2014-10-03 03:00:57 +04:00
[[ost %give %nice ~] mof]
^- [con=_+>.$ tak=$|(~ tank) mof=(list move)]
2014-09-25 04:37:29 +04:00
=+ com=(rush txt parse)
?~ com
2014-10-03 03:00:57 +04:00
[+>.$ leaf/"Clarify {(trip txt)}" ~]
2014-10-08 03:05:44 +04:00
|- ^- [con=_+>.^$ tak=$|(~ tank) mof=(list move)]
2014-09-25 04:37:29 +04:00
?- -.u.com
2014-09-23 02:20:47 +04:00
%path
2014-09-25 04:37:29 +04:00
=. pax p.u.com
2014-10-08 03:05:44 +04:00
[+>.^$ leaf/"=% {(spud p.u.com)}" ~]
2014-09-23 02:20:47 +04:00
::
%start
2014-09-26 04:10:17 +04:00
=+ cil=(scot %ud pid)
=. pid +(pid)
2014-10-08 03:05:44 +04:00
=. pip ?~ inp pip (~(put by pip) u.inp cil)
=. pop ?~ inp pip (~(put by pop) cil u.inp)
=. inp ~
:- +>.^$ :- ~
2014-10-03 02:21:23 +04:00
:* :^ ost %pass /child/[cil]/main
2014-09-25 04:37:29 +04:00
:+ %g %meta !>
:* %mess [our.hid cil imp.hid] you
2014-10-02 04:42:59 +04:00
(cat 3 p.u.com '-args') (run [%clsg q.u.com])
2014-09-25 04:37:29 +04:00
==
2014-09-27 05:01:17 +04:00
[ost %pass /child/[cil]/out %g %show [our.hid cil imp.hid] you /out]
2014-09-26 04:10:17 +04:00
[ost %pass /child/[cil] %g %sire p.u.com cil] :: XX strange order?
2014-10-01 01:07:40 +04:00
(print ost you leaf/"+ :{(trip p.u.com)}" ~)
2014-09-23 02:20:47 +04:00
==
::
%end
2014-10-01 04:29:32 +04:00
?: ?=(%& -.p.u.com)
=+ cil=(scot %ud p.p.u.com)
=+ cin=(trip (~(got by cub.hid) cil))
2014-10-08 03:05:44 +04:00
:- +>.^$ :- ~
:_ (print ost you leaf/"- :{cin}({(trip cil)})" ~)
[ost %pass /child/[cil] %g %cide cil]
2014-10-01 04:29:32 +04:00
=* cil p.p.u.com
2014-10-08 03:05:44 +04:00
=- [+>.^$ leaf/"-{<(lent moz)>} :{(trip cil)}" moz]
2014-10-03 03:00:57 +04:00
^= moz
%+ murn (~(tap by cub.hid)) |= [a=span b=term]
?. =(b cil) ~
%- some
[ost %pass /child/[a] %g %cide a]
2014-10-01 01:53:37 +04:00
::
%pipe
2014-10-08 03:05:44 +04:00
~& [%pipsqueak <p.u.com> <q.u.com>]
=+ cil=(scot %ud pid)
=. pid +(pid)
=. pip ?~ inp pip (~(put by pip) u.inp cil)
=. pop ?~ inp pip (~(put by pop) cil u.inp)
=. inp `cil
=+ nex=$(u.com q.u.com)
:: =. +>.^$ con.nex XX whu??
:+ con.nex tak.nex
%- welp :_ mof.nex
:~ :^ ost %pass /child/[cil]/main
:+ %g %meta !>
:* %mess [our.hid cil imp.hid] you
(cat 3 p.p.u.com '-args') (run [%clsg q.p.u.com])
==
[ost %pass /child/[cil]/out %g %show [our.hid cil imp.hid] you /out]
[ost %pass /child/[cil] %g %sire p.p.u.com cil]
==
2014-10-02 04:42:59 +04:00
::
%var
2014-10-03 03:00:57 +04:00
=. var (~(put by var) p.u.com (run q.u.com))
2014-10-08 03:05:44 +04:00
[+>.^$ leaf/"created variable '{(trip p.u.com)}'" ~]
2014-10-02 04:46:24 +04:00
::
%rvar
2014-10-03 03:00:57 +04:00
=. var (~(del by var) p.u.com)
2014-10-08 03:05:44 +04:00
[+>.^$ leaf/"deleted variable '{(trip p.u.com)}'" ~]
2014-09-25 04:37:29 +04:00
::
%hoon
2014-10-08 03:05:44 +04:00
[+>.^$ (sell (run p.u.com)) ~]
2014-09-12 06:11:03 +04:00
==
::
2014-09-26 04:54:51 +04:00
++ purr
|= [ost=bone pax=path typ=type sih=sign]
2014-09-12 06:11:03 +04:00
^- [(list move) _+>]
2014-10-08 02:38:15 +04:00
::~& shel-purr/pax
2014-09-25 04:37:29 +04:00
:: ~& [%shell-pour -.sih (,@ta +<.sih)]
2014-09-26 04:54:51 +04:00
::=+ sih=((hard sign) sih)
2014-10-04 02:31:16 +04:00
?: ?=(%veer +<.sih) :: vomit
[[ost %give +.sih]~ +>.$]
?: ?=(%vega +<.sih) :: vomit
[[ost %give +.sih]~ +>.$]
2014-09-23 03:06:55 +04:00
?~ pax ~& %no-path !!
2014-09-23 02:20:47 +04:00
?+ &1.pax ~& %strange-path !!
2014-09-23 03:06:55 +04:00
%print
2014-09-27 05:01:17 +04:00
`+>.$
2014-09-23 03:06:55 +04:00
::
2014-09-23 02:20:47 +04:00
%child
2014-09-23 03:06:55 +04:00
?~ |1.pax ~& %no-child !!
?~ |2.pax
2014-09-23 02:20:47 +04:00
?> ?=(%gone +<.sih)
2014-09-27 05:01:17 +04:00
:- [ost %give %nice ~]~
+>.$(act ?:(=(act [~ &2.pax]) ~ act))
:_ +>.$
2014-09-23 03:06:55 +04:00
?+ &3.pax ~& %strange-child-path !!
2014-09-23 05:00:25 +04:00
%main
?> ?=(?(%nice %mean) +<.sih)
2014-10-08 02:38:15 +04:00
:- [ost %give +.sih]
::~& act
(print ost our.hid ~)
2014-09-27 05:01:17 +04:00
%out
2014-09-23 03:06:55 +04:00
?. ?=(?(%rust %rush) +<.sih) ~
2014-10-01 01:53:37 +04:00
?: (~(has by pip) &2.pax)
2014-10-04 05:05:44 +04:00
~& [%yay &2.pax <pip> <pop>]
2014-10-08 03:05:44 +04:00
~& [%spamming-to /in/(~(got by pip) &2.pax) (~(get ju pus.hid) /in/(~(got by pip) &2.pax))]
2014-10-01 01:53:37 +04:00
(spam /in/(~(got by pip) &2.pax) %meta (slot 3 typ sih))
2014-10-04 05:05:44 +04:00
~& [%nay &2.pax <pip> <pop>]
2014-10-01 01:07:40 +04:00
%^ print-vase ost our.hid
2014-09-26 04:54:51 +04:00
?+ p.sih
2014-10-01 01:07:40 +04:00
!>([(sell (slot 15 [typ sih]))]~)
2014-09-26 04:54:51 +04:00
%tang
2014-10-01 01:07:40 +04:00
(slot 15 [typ sih])
2014-09-23 02:20:47 +04:00
==
2014-09-26 04:54:51 +04:00
== ==
2014-09-23 02:20:47 +04:00
::
2014-10-03 03:00:57 +04:00
++ stash
|= [a=bone b=ship c=cord]
%^ spam /out %meta
2014-10-08 02:38:15 +04:00
!>([%rush %term-line `term-line`[prompt [c]~ ~]])
2014-10-03 03:00:57 +04:00
::
2014-10-01 01:07:40 +04:00
++ print |=([a=bone b=ship c=(list tank)] (print-vase a b !>(c)))
++ print-vase
|= [ost=bone you=ship tan=vase] :: [p=p:!>(*(list tank)) q=*]
2014-10-03 02:21:23 +04:00
^- (list move)
2014-10-08 02:38:15 +04:00
::~& shel-print/prompt
%^ spam /out %meta
:(slop !>(%rush) !>(%term-line) !>(prompt) !>(~) tan)
2014-10-01 01:53:37 +04:00
::
2014-10-03 03:00:57 +04:00
++ prompt
2014-10-08 02:38:15 +04:00
^- @t
2014-10-03 03:00:57 +04:00
?^ act
(rap 3 (~(got by cub.hid) u.act) '(' u.act ') ' ~)
?. =('0' &3.pax)
(spat pax)
(rap 3 '/' &1.pax '/' &2.pax '=' ?~(|3.pax ~ [(spat |3.pax)]~))
2014-10-02 04:42:59 +04:00
++ run
|= gen=twig
%- slap :_ gen
%+ roll (~(tap by var))
=< .(q seeb)
2014-10-02 21:24:17 +04:00
|= [[n=term v=vase] q=vase]
(slop [[%face n p.v] q.v] q)
2014-10-02 04:42:59 +04:00
::
2014-09-27 05:01:17 +04:00
++ spam
|= [pax=path gip=gift]
^- (list move)
%+ turn
(~(tap in (~(get ju pus.hid) pax)))
|=(a=bone [a %give gip])
2014-09-12 06:11:03 +04:00
--