:: Terminal :: :::: /hook/core/terminal/app :: /? 314 :: need urbit 314 /- term-line, term-in, term-ctrl, kyev /= stat /:/%%/:/hymn/ :: :::: structures :: |% :: ++ axle $: %1 :: hiz=(map path term-line) :: == :: ++ gilt :: $% [%term-line p=term-line] :: [%hymn p=manx] :: == :: ++ gift :: $% [%rush gilt] :: [%rust gilt] :: [%mean p=ares] :: [%nice ~] :: [%sage p=path q=*] :: [%verb ~] :: [%veer p=@ta q=path r=@t] :: [%vega p=path] :: == :: ++ glas ?(%term %lines) :: ++ hapt ,[p=ship q=path] :: ++ mess :: $% [%txt p=(hypo cord)] :: [%kyev p=(hypo kyev)] :: == :: ++ 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=mess] :: == == == :: ++ sign :: $% $: %g :: $% [%gone p=hapt] :: [%mean p=ares] :: [%nice ~] :: [%rust p=%term-line q=term-line] :: [%rush p=%term-line q=term-line] :: [%sage p=path q=*] :: [%verb ~] :: [%veer p=@ta q=path r=@t] :: [%vega p=path] :: == == == -- !: :::: helpers :: |% ++ aut %shell ++ 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))) ++ inject |= [a=[i=mane t=(list mane)] b=marl] |= man=manx ?. =(i.a n.g.man) man ?~ t.a man(c (weld c.man b)) man(c (turn c.man ^$(a t.a))) :: ++ start-shell |= [our=ship imp=path ost=bone you=ship pax=path] ^- (list move) =+ auc=(encode aut pax) :- [ost %pass [%fork pax] %g %sire [aut auc]] [ost %pass [%resp pax] %g %show [our [auc imp]] you /out]~ -- !: :::: per shell :: |% ++ se |= [hid=hide ost=bone you=ship hiz=(map path term-line) pax=path] =+ tel=(fall (~(get by hiz) pax) *term-line) =+ auc=(encode aut pax) =^ mow tel ?: (~(has by cub.hid) auc) [~ tel] :- (start-shell our.hid imp.hid ost you pax) tel(r :_(r.tel leaf/"+ {(trip aut)}")) |% ++ abet ^- [(list move) (map path term-line)] [(flop mow) (~(put by hiz) pax tel)] :: ++ page %. stat %+ inject ~[%html %head] ;= ;script: urb.appl = "{(trip app.hid)}" ;script: urb.term = \{pax: "{(spud pax)}"} == :: ++ peer |= gal=glas %_ +>.$ mow :_ mow ?- gal %term [ost %give %rust %hymn page] :: hymn front end %lines [ost %give %rust %term-line tel] :: term-line output == == :: ++ poke |= jof=$%([%line p=span] [%res p=span] [%cmd p=char]) ^+ +> ?- -.jof %res :: restart shell =. +>.$ ?. (~(has by cub.hid) auc) +>.$ %_ +>.$ mow :_(mow [ost %pass [%fork pax] %g %cide auc]) r.tel :_(r.tel leaf/"- {(trip aut)}") == %_ +>.$ r.tel :_(r.tel leaf/"+ {(trip auc)}") mow ;: welp (spam tel) [ost %give %nice ~]~ (start-shell our.hid imp.hid ost you pax) mow == == :: %line :: command entered =. r.tel :_ r.tel stem/[leaf/(trip p.tel) leaf/(trip p.jof)] ?: =('\\' (end 3 1 p.jof)) $(jof [%cmd (rsh 3 1 p.jof)]) (send %txt -:!>(*cord) p.jof) :: %cmd :: key command ?+ p.jof (send %kyev -:!>(*kyev) [[%ctrl ~ ~] p.jof]) %r $(jof [%res 'shell']) == == :: ++ poke-ctrl .(mow :_(mow [ost %give %rush %term-line [p q ~]:tel])) :: ++ pour |= [dis=?(%fork %resp %txt %kyev) sih=sign] ^+ +> ?- dis %fork ?>(?=(%gone +<.sih) +>.$) :: XX maybe mean? %resp ?+ +<.sih !! %nice +>.$ ?(%rust %rush) =. p.q.sih ?^(q.q.sih p.tel (cat 3 p.q.sih '> ')) :: XX prompt hack %_ +>.$ mow (welp (spam q.sih) mow) tel [p.q.sih (weld q.q.sih q.tel) (weld r.q.sih r.tel)] == == :: ?(%txt %kyev) ?+ +<.sih !! %nice +>.$(mow :_(mow [ost %give +.sih])) %mean =+ ^= new =- (turn - |=(a=tank rose/[~ "! " ~]^[a]~)) ^- (list tank) ?~ p.sih ~ (welp q.u.p.sih leaf/(trip p.u.p.sih) ~) %_ +>.$ r.tel (welp new r.tel) mow %- welp :_ mow [[ost %give +.sih] (spam [p.tel q.tel new])] == == == :: ++ send |= mez=mess %_ +>.$ mow %- welp :_ mow ^- (list move) %+ murn (~(tap by cub.hid)) |= [p=span q=term] ?. =(pax q:(decode p)) ~ %- some ^- move :^ ost %pass [-.mez pax] [%g %mess [our.hid p imp.hid] you mez] == :: ++ spam |= tol=term-line ^- (list move) %+ murn (~(tap by sup.hid)) |= [ost=bone @ paf=path] ?: =([%lines pax] paf) (some ost %give %rush %term-line tol) ~ -- -- !: :::: formal interface :: |_ [hid=hide axle] ++ peer |= [ost=bone you=ship pax=path] ^- [(list move) _+>] ?~ pax $(pax /term) ?. ?=(glas i.pax) [[ost %give %mean ~ %bad-path ~]~ +>.$] =+ abet:(peer:(se hid ost you hiz t.pax) i.pax) [-< +>.$(hiz ->)] :: ++ poke-term-in |= [ost=bone you=ship term-in] ^- [(list move) _+>] =+ abet:(poke:(se hid ost you hiz pax) jof) [-< +>.$(hiz ->)] :: ++ poke-term-ctrl |= [ost=bone you=ship col=term-ctrl] ^- [(list move) _+>] =+ abet:poke-ctrl:(se hid ost you hiz /) [-< +>.$(hiz ->)] :: ++ pour |= [ost=bone pax=path sih=*] ^- [(list move) _+>] =+ sih=((hard sign) sih) ?: ?=(?(%sage %verb %veer %vega) &2.sih) :: vomit [[ost %give +.sih]~ +>.$] ?~ pax !! ?. ?=(?(%fork %resp %txt %kyev) i.pax) !! =+ abet:(pour:(se hid ost our.hid hiz t.pax) i.pax sih) [-< +>.$(hiz ->)] --