Add terminal pipes #3
Loading…
Reference in a new issue
No description provided.
Delete branch "refs/pull/3/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds a working
|pipe mechanic to the terminal, plus two new composable commands —figlet(block-ASCII banner text) andlolcat(rainbow colorizer) — and makes the existingecho,fortune,cat, andcowsaycommands pipe-aware so they finally compose.fortune | cowsay
figlet bnied | lolcat
echo hello | figlet | lolcat
cat about | cowsay
What changed
js/pipeline.js) — splits input on|, runs the first stage as a source and each later stage as a filter, threading plain text between them. Returns{ lines, colorize }or{ error }.js/figlet.js+data/figlet-font.json) — pure, data-driven renderer over a hand-authored 42-glyph 5×5 block font (A–Z,0–9, space,! ? . , -), uppercase-folded with a fallback glyph for unknown characters.colorizeflag, so it composes anywhere.echo/fortune/cat/cowsaynow work as pipe stages.js/figlet.js,js/cowsay.js,js/pipeline.js) shared by both the direct command branches injs/commands.jsand the pipe engine. The pipe engine activates only when input contains|, so the ~40 existing commands and easter eggs are untouched.state.DATA.figletFont;figlet/lolcatadded tostate.COMMANDS(tab-completion);helpandREADMEupdated.--testunit tests for the pure cores, zero dependencies, no build step (one-linepackage.jsonadding"type": "module").Test plan
node --test→ 17 passingpython3 -m http.server 8000) and verify:figlet hirenders block-ASCII text; barefigletshows a usage linelolcat hellorenders rainbow text; barelolcatshows a usage linefortune | cowsay,figlet bnied | lolcat,echo hello | figlet | lolcat,cat about | cowsayecho x | bogus→bogus: command not found;echo x |→ pipe syntax errorfigl→figlet,lolc→lolcattheme amber,theme blue)cowsay moo,ls -la,neofetchrender as beforeNotes
js/commands.jsescapes before it reachesinnerHTML(verified — no XSS).cat contact | cowsay) shows the markup as escaped literal text. Correctlyescaped and arguably shell-accurate;
cat about | cowsay(plain text) is unaffected.