:: Shell :: :::: /hook/core/shell/app :: /? 314 /- term-line, kyev /= pit /~ !>(.) :: kernel vase :: :::: structures :: |% :: ++ axle :: $: pid=@u :: next process id pax=_`path`/=try= :: working directory act=(unit span) :: active child pip=(map span span) :: pipe out->in pop=(map span span) :: pipe in->out pot=(map span ,[cord prom cord]) :: prompts var=(map term vase) :: variables == :: ++ gift :: $% [%rush p=gilt] :: [%init p=@p] :: [%logo p=@] :: [%mean p=ares] :: [%nice ~] :: [%meta p=vase] :: [%sage p=path q=*] :: [%verb ~] :: [%veer p=@ta q=path r=@t] :: [%vega p=path] :: == :: ++ gilt :: $% [%term-line p=term-line] :: [%txt p=cord] :: == :: ++ glas $|(%out [%in p=cord]) :: ++ hapt ,[p=ship q=path] :: ++ move ,[p=bone q=(mold note gift)] :: ++ note :: $% $: %c :: $% [%info p=@p q=toro] :: == == :: $: %g :: $% [%cide p=span] :: [%show p=hapt q=ship r=path] :: [%sire p=term q=span] :: [%mess p=hapt q=ship r=cage] :: [%meta p=vase] :: == == == :: ++ mand ,[p=term q=(list twig)] :: name and arguments ++ coma :: $% [%run p=(list mand) q=mand] :: pipe into [%end p=(each ,@u cord)] :: kill pid/name [%path p=path] :: chdir [%del p=path] :: rm file [%ins p=path q=(unit twig)] :: add file [%mut p=path q=twig] :: change file [%hoon p=twig] :: eval expression [%comt ~] :: comment [%var p=term q=twig] :: set variable [%rvar p=term] :: unset variable == :: ++ sign :: $% $: %g :: $% [%gone p=hapt] :: [%init p=@p] :: [%mean p=ares] :: [%nice ~] :: [%rush p=mark q=*] :: [%rust p=mark q=*] :: [%sage p=path q=*] :: [%verb ~] :: [%veer p=@ta q=path r=@t] :: [%vega p=path] :: == == == :: -- !: :::: parsers :: |% ++ maybe |*(fel=_rule (cook |*(a=(unit) (fall a ~)) (opts fel))) ++ opts :: parse unit |* fel=_rule ;~ pose (cook some fel) (easy ~) == :: ++ from :: parse door =+ tol=`?(0 1 2)`%2 :: wide, tallish, tall |_ [pax=path lat=time] ++ rail :: build from wide/tall |* [wid=_rule wif=_rule tal=_rule] ?~ tol wid =- ;~(pose wif wid) ^= wif ?: ?=(1 tol) wif ;~(pose tal wif) :: ++ rais |*([wid=_rule tal=_rule] (rail wid wid tal)) :: ++ parse :: top level ^- $+(nail (like coma)) =+ paf=pax =. pax ?.(&(?=([@ @ @ *] pax) =('0' &3.pax)) pax pax(&3 (scot da/lat))) %+ ifix [(star ace) gaw] ;~ pose (stag %run ;~(plug (star ;~(sfix (task(tol %0) bar) ace)) (task col))) (stag %end ;~(pfix col sem ;~(pose (stag %& dem) (stag %| sym)))) (stag %del ;~(pfix hep ace loca)) (stag %mut ;~(pfix col ace ;~(plug loca expg))) (stag %ins ;~(pfix lus ace ;~(plug loca (opts expg)))) (stag %path (full ;~(sfix loca(pax paf) (star ace)))) (stag %var ;~(plug ;~(pfix tis sym) expg)) (stag %rvar ;~(pfix ;~(plug tis tis) sym)) (stag %hoon expr) (stag %comt ;~(pfix col col (cold ~ (star prn)))) (stag %comt (easy ~)) == :: ++ expg (rais ;~(pfix ace expr(tol %1)) ;~(pfix gap expr)) ++ expr (rais [wide tall]:(vang & pax)) ++ loca %+ sear ;~(biff plex:(vang & pax) vabe) :: path in %clay [;~(pose rood ;~(simu cen scat))]:(vang & pax) ++ vabe |=(a=path ?~((tome a) ~ (some a))) :: check valid beam ++ args :: task arguments %^ rail (ifix sel^ser (most ace expr)) (plus ;~(pfix ace expr)) ;~(sfix (plus ;~(pfix gap expr)) ;~(plug gap duz)) :: ++ task |*(fel=_rule ;~(pfix fel ;~(plug sym (maybe args)))) :: -- -- !: :::: per event :: |% ++ ve |= [hid=hide ost=bone axle] =* vat +<+> =| mow=(list move) |% ++ abet ^- [(list move) axle] [(flop mow) vat] :: ++ blab |= mof=(list move) +>.$(mow (welp mof mow)) :: ++ chew-file |= [paf=path msg=tape tor=(unit toro)] ^- (list move) %+ welp (print palm/[" " ~ ~ ~]^~[leaf/msg (dank:ut paf)]) %+ turn (drop tor) |=(a=toro [ost %pass writ/paf %c %info our.hid a]) :: ++ cubs :: tasks with open /in %- 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) !(~(has by pop) i.t.a) == ~ (some i.t.a) :: ++ eat |= [you=ship com=coma] ?- -.com %comt +>.$ %del (eat-del +.com) %end (eat-end +.com) %hoon (eat-hoon +.com) %ins (eat-ins +.com) %mut (eat-mut +.com) %path (eat-path +.com) %run (eat-run you +.com) %rvar (eat-rvar +.com) %var (eat-var +.com) == :: ++ eat-del |= paf=path ^+ +> =. &3.paf '=' %- blab %+ chew-file paf ?^ (file paf) ["! none" ~] ["deleted" `(fray paf)] :: ++ eat-end :: XX clean up state |= poc=(each ,@u cord) ^+ +> ?- -.poc %& =+ cil=(scot %ud p.poc) =+ cin=(trip (~(got by cub.hid) cil)) %+ blab [ost %pass /child/[cil]/fork %g %cide cil] (print leaf/"- :{cin}({(trip cil)})") :: %| =+ ^- moz=(list move) %+ murn (~(tap by cub.hid)) |= [a=span b=term] ?. =(b p.poc) ~ %- some [ost %pass /child/[a]/fork %g %cide a] %- blab %+ welp moz (print leaf/"-{<(lent moz)>} :{(trip p.poc)}") == :: ++ eat-hoon |= gen=twig ^+ +> (blab (print (sell (exec gen)))) :: ++ eat-ins |= [paf=path gen=(unit twig)] ^+ +> =. &3.paf '=' %- blab %+ chew-file paf ?^ (file paf) ["! exists" ~] :- "written" `(foal paf q:(exec (fall gen [%bczp atom/%t]))) :: ++ eat-mut |= [paf=path gen=twig] ^+ +> =. &3.paf '=' %- blab %+ chew-file paf ?^ (file paf) ["! none" ~] ["changed" `(foal paf q:(exec gen))] :: ++ eat-path |= paf=path ^+ +> =. pax paf (blab (print leaf/"=% {(spud paf)}")) :: ++ eat-run |= [you=ship mud=(list mand) mad=mand] ^+ +> :: =. +>.$ (blab (print leaf/"+ :{(trip p.mad)}")) ?: .= [0 0 0] .^(%cy /(scot %p our.hid)/main/(scot %da lat.hid)/app/[p.mad]) (blab (print leaf/"{