@prozilla-os/core 1.3.13 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/dist/chunks/cat-DH-kPf08.js +44 -0
  2. package/dist/chunks/cat-DH-kPf08.js.map +1 -0
  3. package/dist/chunks/cd-DGILEGTs.js +21 -0
  4. package/dist/chunks/cd-DGILEGTs.js.map +1 -0
  5. package/dist/chunks/clear-DC-frUcf.js +13 -0
  6. package/dist/chunks/clear-DC-frUcf.js.map +1 -0
  7. package/dist/chunks/cmatrix-DvaWzvRn.js +63 -0
  8. package/dist/chunks/cmatrix-DvaWzvRn.js.map +1 -0
  9. package/dist/chunks/compgen-OhvISbst.js +11 -0
  10. package/dist/chunks/compgen-OhvISbst.js.map +1 -0
  11. package/dist/chunks/cowsay-hTKzWScw.js +56 -0
  12. package/dist/chunks/cowsay-hTKzWScw.js.map +1 -0
  13. package/dist/chunks/date-D8cnHZuY.js +33 -0
  14. package/dist/chunks/date-D8cnHZuY.js.map +1 -0
  15. package/dist/chunks/dir-BmNeEPzy.js +11 -0
  16. package/dist/chunks/dir-BmNeEPzy.js.map +1 -0
  17. package/dist/chunks/echo-Gmh-b8f5.js +17 -0
  18. package/dist/chunks/echo-Gmh-b8f5.js.map +1 -0
  19. package/dist/chunks/eval-DINS_Vhl.js +24 -0
  20. package/dist/chunks/eval-DINS_Vhl.js.map +1 -0
  21. package/dist/chunks/exit-w3PqRkwA.js +10 -0
  22. package/dist/chunks/exit-w3PqRkwA.js.map +1 -0
  23. package/dist/chunks/fortune-DkIZpYa_.js +59 -0
  24. package/dist/chunks/fortune-DkIZpYa_.js.map +1 -0
  25. package/dist/chunks/grep-CR3FMStR.js +41 -0
  26. package/dist/chunks/grep-CR3FMStR.js.map +1 -0
  27. package/dist/chunks/help-Drx0UDCY.js +19 -0
  28. package/dist/chunks/help-Drx0UDCY.js.map +1 -0
  29. package/dist/chunks/history-BEJhnsrb.js +17 -0
  30. package/dist/chunks/history-BEJhnsrb.js.map +1 -0
  31. package/dist/chunks/hostname-D8sxyWIy.js +10 -0
  32. package/dist/chunks/hostname-D8sxyWIy.js.map +1 -0
  33. package/dist/chunks/htop-l0sNRNKZ.js +2 -0
  34. package/dist/chunks/htop-l0sNRNKZ.js.map +1 -0
  35. package/dist/chunks/lolcat-Dyjbg15t.js +67 -0
  36. package/dist/chunks/lolcat-Dyjbg15t.js.map +1 -0
  37. package/dist/chunks/ls-DnmR50y0.js +17 -0
  38. package/dist/chunks/ls-DnmR50y0.js.map +1 -0
  39. package/dist/chunks/man-7W6T7lda.js +60 -0
  40. package/dist/chunks/man-7W6T7lda.js.map +1 -0
  41. package/dist/chunks/mkdir-BdEywO2H.js +11 -0
  42. package/dist/chunks/mkdir-BdEywO2H.js.map +1 -0
  43. package/dist/chunks/neofetch--vHMIS9v.js +40 -0
  44. package/dist/chunks/neofetch--vHMIS9v.js.map +1 -0
  45. package/dist/chunks/printenv-6OpJKd7g.js +24 -0
  46. package/dist/chunks/printenv-6OpJKd7g.js.map +1 -0
  47. package/dist/chunks/pwd-9JYDUbov.js +11 -0
  48. package/dist/chunks/pwd-9JYDUbov.js.map +1 -0
  49. package/dist/chunks/reboot-nbAmZck6.js +10 -0
  50. package/dist/chunks/reboot-nbAmZck6.js.map +1 -0
  51. package/dist/chunks/reload-CjTJVt5Z.js +10 -0
  52. package/dist/chunks/reload-CjTJVt5Z.js.map +1 -0
  53. package/dist/chunks/rev--2pyt1P8.js +12 -0
  54. package/dist/chunks/rev--2pyt1P8.js.map +1 -0
  55. package/dist/chunks/rm-Uxuv-dEz.js +13 -0
  56. package/dist/chunks/rm-Uxuv-dEz.js.map +1 -0
  57. package/dist/chunks/rmdir-BYWer3pb.js +13 -0
  58. package/dist/chunks/rmdir-BYWer3pb.js.map +1 -0
  59. package/dist/chunks/sh-B67OTc-j.js +15 -0
  60. package/dist/chunks/sh-B67OTc-j.js.map +1 -0
  61. package/dist/chunks/sl-CLAmugya.js +168 -0
  62. package/dist/chunks/sl-CLAmugya.js.map +1 -0
  63. package/dist/chunks/touch-BReUyL_z.js +15 -0
  64. package/dist/chunks/touch-BReUyL_z.js.map +1 -0
  65. package/dist/chunks/uniq-Dx_4r3B5.js +44 -0
  66. package/dist/chunks/uniq-Dx_4r3B5.js.map +1 -0
  67. package/dist/chunks/uptime-DjJ5V7hu.js +10 -0
  68. package/dist/chunks/uptime-DjJ5V7hu.js.map +1 -0
  69. package/dist/chunks/watch-BjJ8bCnP.js +52 -0
  70. package/dist/chunks/watch-BjJ8bCnP.js.map +1 -0
  71. package/dist/chunks/whatis-CFZWdHZ4.js +17 -0
  72. package/dist/chunks/whatis-CFZWdHZ4.js.map +1 -0
  73. package/dist/chunks/whoami-D-es0JvS.js +10 -0
  74. package/dist/chunks/whoami-D-es0JvS.js.map +1 -0
  75. package/dist/main.d.ts +1029 -473
  76. package/dist/main.js +18432 -16877
  77. package/dist/main.js.map +1 -1
  78. package/package.json +15 -11
@@ -0,0 +1,44 @@
1
+ import { Command as w, EXIT_CODE as E, Stream as i, Shell as s } from "../main.js";
2
+ const T = new w().setManual({
3
+ purpose: "Concatenate files and display on the terminal screen",
4
+ usage: "cat [OPTION]... [FILE]...",
5
+ description: "Concatenate FILE(s) to standard output. With no FILE, or when FILE is -, read standard input.",
6
+ options: {
7
+ "-e": "Display $ at end of each line"
8
+ }
9
+ }).addOption({ short: "e", long: "show-ends", isInput: !1 }).setExecute(async function(r, { workingDirectory: f, options: p, stdout: d, stderr: c, stdin: n }) {
10
+ let o = E.success;
11
+ const a = (t) => {
12
+ let e = t;
13
+ p.includes("e") && (e = e.split(`
14
+ `).join(`$
15
+ `) + "$"), d.write(e);
16
+ };
17
+ if (r.length === 0)
18
+ return n.on(i.DATA_EVENT, (t) => {
19
+ a(t);
20
+ }), n.wait(E.success);
21
+ for (const t of r) {
22
+ if (t === "-") {
23
+ const l = (h) => a(h);
24
+ n.on(i.DATA_EVENT, l), await n.wait(), n.off(i.DATA_EVENT, l);
25
+ continue;
26
+ }
27
+ const e = f.navigate(t);
28
+ if (!e) {
29
+ o = s.writeError(c, this.name, `${t}: ${s.INVALID_PATH_ERROR}`);
30
+ continue;
31
+ }
32
+ if (e.isFolder()) {
33
+ o = s.writeError(c, this.name, `${t}: Is a directory`);
34
+ continue;
35
+ }
36
+ const u = await e.read();
37
+ u != null && a(u);
38
+ }
39
+ return o;
40
+ });
41
+ export {
42
+ T as cat
43
+ };
44
+ //# sourceMappingURL=cat-DH-kPf08.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cat-DH-kPf08.js","sources":["../../src/features/shell/commands/cat.ts"],"sourcesContent":["import { EXIT_CODE } from \"../../../constants\";\nimport { Command } from \"../command\";\nimport { Shell } from \"../shell\";\nimport { Stream } from \"../stream\";\n\nexport const cat = new Command()\n\t.setManual({\n\t\tpurpose: \"Concatenate files and display on the terminal screen\",\n\t\tusage: \"cat [OPTION]... [FILE]...\",\n\t\tdescription: \"Concatenate FILE(s) to standard output. With no FILE, or when FILE is -, read standard input.\",\n\t\toptions: {\n\t\t\t\"-e\": \"Display $ at end of each line\",\n\t\t},\n\t})\n\t.addOption({ short: \"e\", long: \"show-ends\", isInput: false })\n\t.setExecute(async function(this: Command, args, { workingDirectory, options, stdout, stderr, stdin }) {\n\t\tlet exitCode: number = EXIT_CODE.success;\n\n\t\t// Helper to format and write content with options\n\t\tconst writeContent = (content: string) => {\n\t\t\tlet output = content;\n\t\t\tif (options.includes(\"e\")) {\n\t\t\t\toutput = output.split(\"\\n\").join(\"$\\n\") + \"$\";\n\t\t\t}\n\t\t\tstdout.write(output);\n\t\t};\n\n\t\t// Read from stdin\n\t\tif (args.length === 0) {\n\t\t\tstdin.on(Stream.DATA_EVENT, (data) => {\n\t\t\t\twriteContent(data);\n\t\t\t});\n\t\t\treturn stdin.wait(EXIT_CODE.success);\n\t\t}\n\n\t\t// Iterate through file arguments\n\t\tfor (const path of args) {\n\t\t\tif (path === \"-\") {\n\t\t\t\tconst onData = (data: string) => writeContent(data);\n\t\t\t\tstdin.on(Stream.DATA_EVENT, onData);\n\t\t\t\tawait stdin.wait();\n\t\t\t\tstdin.off(Stream.DATA_EVENT, onData);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst target = workingDirectory.navigate(path);\n\n\t\t\tif (!target) {\n\t\t\t\texitCode = Shell.writeError(stderr, this.name, `${path}: ${Shell.INVALID_PATH_ERROR}`);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (target.isFolder()) {\n\t\t\t\texitCode = Shell.writeError(stderr, this.name, `${path}: Is a directory`);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst content = await target.read();\n\t\t\tif (content != null) {\n\t\t\t\twriteContent(content);\n\t\t\t}\n\t\t}\n\n\t\treturn exitCode;\n\t});"],"names":["cat","Command","args","workingDirectory","options","stdout","stderr","stdin","exitCode","EXIT_CODE","writeContent","content","output","Stream","data","path","onData","target","Shell"],"mappings":";AAKO,MAAMA,IAAM,IAAIC,EAAA,EACrB,UAAU;AAAA,EACV,SAAS;AAAA,EACT,OAAO;AAAA,EACP,aAAa;AAAA,EACb,SAAS;AAAA,IACR,MAAM;AAAA,EAAA;AAER,CAAC,EACA,UAAU,EAAE,OAAO,KAAK,MAAM,aAAa,SAAS,GAAA,CAAO,EAC3D,WAAW,eAA8BC,GAAM,EAAE,kBAAAC,GAAkB,SAAAC,GAAS,QAAAC,GAAQ,QAAAC,GAAQ,OAAAC,KAAS;AACrG,MAAIC,IAAmBC,EAAU;AAGjC,QAAMC,IAAe,CAACC,MAAoB;AACzC,QAAIC,IAASD;AACb,IAAIP,EAAQ,SAAS,GAAG,MACvBQ,IAASA,EAAO,MAAM;AAAA,CAAI,EAAE,KAAK;AAAA,CAAK,IAAI,MAE3CP,EAAO,MAAMO,CAAM;AAAA,EACpB;AAGA,MAAIV,EAAK,WAAW;AACnB,WAAAK,EAAM,GAAGM,EAAO,YAAY,CAACC,MAAS;AACrC,MAAAJ,EAAaI,CAAI;AAAA,IAClB,CAAC,GACMP,EAAM,KAAKE,EAAU,OAAO;AAIpC,aAAWM,KAAQb,GAAM;AACxB,QAAIa,MAAS,KAAK;AACjB,YAAMC,IAAS,CAACF,MAAiBJ,EAAaI,CAAI;AAClD,MAAAP,EAAM,GAAGM,EAAO,YAAYG,CAAM,GAClC,MAAMT,EAAM,KAAA,GACZA,EAAM,IAAIM,EAAO,YAAYG,CAAM;AACnC;AAAA,IACD;AAEA,UAAMC,IAASd,EAAiB,SAASY,CAAI;AAE7C,QAAI,CAACE,GAAQ;AACZ,MAAAT,IAAWU,EAAM,WAAWZ,GAAQ,KAAK,MAAM,GAAGS,CAAI,KAAKG,EAAM,kBAAkB,EAAE;AACrF;AAAA,IACD;AAEA,QAAID,EAAO,YAAY;AACtB,MAAAT,IAAWU,EAAM,WAAWZ,GAAQ,KAAK,MAAM,GAAGS,CAAI,kBAAkB;AACxE;AAAA,IACD;AAEA,UAAMJ,IAAU,MAAMM,EAAO,KAAA;AAC7B,IAAIN,KAAW,QACdD,EAAaC,CAAO;AAAA,EAEtB;AAEA,SAAOH;AACR,CAAC;"}
@@ -0,0 +1,21 @@
1
+ import { Command as c, Shell as i } from "../main.js";
2
+ const h = new c().setManual({
3
+ purpose: "Change the current directory",
4
+ usage: "cd [PATH]",
5
+ description: "Change working directory to given path (the home directory by default)."
6
+ }).setExecute(function(n, { workingDirectory: o, shell: a, stderr: r }) {
7
+ const t = n[0] ?? "~";
8
+ let e = o.navigate(t);
9
+ if (!e)
10
+ return i.writeError(r, this.name, `${t}: No such file or directory`);
11
+ if (e.isFile()) {
12
+ if (e.parent == null)
13
+ return i.writeError(r, this.name, `${t}: Invalid path`);
14
+ e = e.parent;
15
+ }
16
+ a.setWorkingDirectory(e);
17
+ });
18
+ export {
19
+ h as cd
20
+ };
21
+ //# sourceMappingURL=cd-DGILEGTs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cd-DGILEGTs.js","sources":["../../src/features/shell/commands/cd.ts"],"sourcesContent":["import { Shell } from \"../shell\";\nimport { Command } from \"../command\";\n\nexport const cd = new Command()\n\t.setManual({\n\t\tpurpose: \"Change the current directory\",\n\t\tusage: \"cd [PATH]\",\n\t\tdescription: \"Change working directory to given path (the home directory by default).\",\n\t})\n\t.setExecute(function(this: Command, args, { workingDirectory, shell, stderr }) {\n\t\tconst path = args[0] ?? \"~\";\n\t\tlet destination = workingDirectory.navigate(path);\n\t\n\t\tif (!destination)\n\t\t\treturn Shell.writeError(stderr, this.name, `${path}: No such file or directory`);\n\n\t\tif (destination.isFile()) {\n\t\t\tif (destination.parent == null) {\n\t\t\t\treturn Shell.writeError(stderr, this.name, `${path}: Invalid path`);\n\t\t\t} else {\n\t\t\t\tdestination = destination.parent;\n\t\t\t}\n\t\t}\n\t\n\t\tshell.setWorkingDirectory(destination);\n\t});"],"names":["cd","Command","args","workingDirectory","shell","stderr","path","destination","Shell"],"mappings":";AAGO,MAAMA,IAAK,IAAIC,EAAA,EACpB,UAAU;AAAA,EACV,SAAS;AAAA,EACT,OAAO;AAAA,EACP,aAAa;AACd,CAAC,EACA,WAAW,SAAwBC,GAAM,EAAE,kBAAAC,GAAkB,OAAAC,GAAO,QAAAC,KAAU;AAC9E,QAAMC,IAAOJ,EAAK,CAAC,KAAK;AACxB,MAAIK,IAAcJ,EAAiB,SAASG,CAAI;AAEhD,MAAI,CAACC;AACJ,WAAOC,EAAM,WAAWH,GAAQ,KAAK,MAAM,GAAGC,CAAI,6BAA6B;AAEhF,MAAIC,EAAY,UAAU;AACzB,QAAIA,EAAY,UAAU;AACzB,aAAOC,EAAM,WAAWH,GAAQ,KAAK,MAAM,GAAGC,CAAI,gBAAgB;AAElE,IAAAC,IAAcA,EAAY;AAAA,EAE5B;AAEA,EAAAH,EAAM,oBAAoBG,CAAW;AACtC,CAAC;"}
@@ -0,0 +1,13 @@
1
+ import { Command as r } from "../main.js";
2
+ const t = new r().setManual({
3
+ purpose: "Clear terminal screen"
4
+ }).setExecute(function(a, { shell: e }) {
5
+ e.pushHistory({
6
+ clear: !0,
7
+ isCommand: !1
8
+ });
9
+ });
10
+ export {
11
+ t as clear
12
+ };
13
+ //# sourceMappingURL=clear-DC-frUcf.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clear-DC-frUcf.js","sources":["../../src/features/shell/commands/clear.ts"],"sourcesContent":["import { Command } from \"../command\";\n\nexport const clear = new Command()\n\t.setManual({\n\t\tpurpose: \"Clear terminal screen\",\n\t})\n\t.setExecute(function(_args, { shell }) {\n\t\tshell.pushHistory({\n\t\t\tclear: true,\n\t\t\tisCommand: false,\n\t\t});\n\t});"],"names":["clear","Command","_args","shell"],"mappings":";AAEO,MAAMA,IAAQ,IAAIC,EAAA,EACvB,UAAU;AAAA,EACV,SAAS;AACV,CAAC,EACA,WAAW,SAASC,GAAO,EAAE,OAAAC,KAAS;AACtC,EAAAA,EAAM,YAAY;AAAA,IACjB,OAAO;AAAA,IACP,WAAW;AAAA,EAAA,CACX;AACF,CAAC;"}
@@ -0,0 +1,63 @@
1
+ import { randomRange as p, Vector2 as l, removeFromArray as d, randomFromArray as g, ANSI as m } from "@prozilla-os/shared";
2
+ import { Command as h, Shell as y } from "../main.js";
3
+ const w = 1.25, A = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.*\\/()#@&$!?%°:<>[]", c = {
4
+ spawnRate: 30,
5
+ fallSpeed: 1,
6
+ minSize: 5,
7
+ maxSize: 25
8
+ };
9
+ function S(a) {
10
+ const o = [];
11
+ for (let r = 0; r < a.y; r++) {
12
+ const e = [];
13
+ for (let i = 0; i < a.x; i++)
14
+ e.push(" ");
15
+ o.push(e);
16
+ }
17
+ return o;
18
+ }
19
+ function E(a, o, r, e) {
20
+ const i = Math.round(5e3 / (c.spawnRate * e.x));
21
+ if (i === 0 || a % i === 0) {
22
+ const n = {
23
+ position: new l(p(0, e.x - 1), e.y).round(),
24
+ size: Math.round(p(c.minSize, c.maxSize))
25
+ };
26
+ r.push(n);
27
+ }
28
+ return r.forEach((n) => {
29
+ n.position.y -= c.fallSpeed;
30
+ for (let t = 0; t < c.fallSpeed; t++) {
31
+ const f = n.position.x, s = n.position.y + t + n.size;
32
+ s < e.y && s >= 0 && (o[s][f] = " ");
33
+ }
34
+ if (n.position.y + n.size <= 0 || n.position.x >= e.x)
35
+ return d(n, r);
36
+ for (let t = 0; t < n.size; t++) {
37
+ const f = g(A.split(""));
38
+ let s = t == 0 ? m.fg.white : m.fg.green;
39
+ t > n.size / 2 && (s = m.fg.green + m.decoration.dim);
40
+ const x = n.position.x, u = n.position.y + t;
41
+ x < e.x && u < e.y && u >= 0 && (o[u][x] = s + f + m.reset);
42
+ }
43
+ }), [...o.map((n) => n.join(""))].reverse().join(`
44
+ `);
45
+ }
46
+ const C = new h().setManual({
47
+ purpose: "Show a scrolling 'Matrix' like screen",
48
+ usage: "cmatrix"
49
+ }).setExecute(function(a, { size: o, stdin: r, stdout: e }) {
50
+ const i = [];
51
+ let n = S(o);
52
+ const t = 100 / w;
53
+ return y.animate({
54
+ stdin: r,
55
+ stdout: e,
56
+ delay: t,
57
+ render: (f) => ((n.length !== o.y || (n.length !== 0 ? n[0].length : 0) !== o.x) && (n = S(o)), E(f, n, i, o))
58
+ });
59
+ });
60
+ export {
61
+ C as cmatrix
62
+ };
63
+ //# sourceMappingURL=cmatrix-DvaWzvRn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cmatrix-DvaWzvRn.js","sources":["../../src/features/shell/commands/cmatrix.ts"],"sourcesContent":["import { Vector2 } from \"@prozilla-os/shared\";\nimport { ANSI, randomFromArray, randomRange, removeFromArray } from \"@prozilla-os/shared\";\nimport { Command } from \"../command\";\nimport { Shell } from \"../shell\";\n\nconst ANIMATION_SPEED = 1.25;\nconst CHARACTERS = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.*\\\\/()#@&$!?%°:<>[]\";\n\nconst PARTICLES = {\n\tspawnRate: 30,\n\tfallSpeed: 1,\n\tminSize: 5,\n\tmaxSize: 25,\n};\n\ntype Particle = {\n\tposition: Vector2,\n\tsize: number;\n};\n\nfunction initializeScreen(size: Vector2) {\n\tconst screen: string[][] = [];\n\tfor (let y = 0; y < size.y; y++) {\n\t\tconst row: string[] = [];\n\t\tfor (let x = 0; x < size.x; x++) {\n\t\t\trow.push(\" \");\n\t\t}\n\t\tscreen.push(row);\n\t}\n\treturn screen;\n}\n\nfunction generateScreen(frame: number, screen: string[][], particles: Particle[], size: Vector2): string {\n\tconst framesBetweenSpawn = Math.round(5000 / (PARTICLES.spawnRate * size.x));\n\n\t// Spawn new particles\n\tif (framesBetweenSpawn === 0 || frame % framesBetweenSpawn === 0) {\n\t\tconst newParticle: Particle = {\n\t\t\tposition: new Vector2(randomRange(0, size.x - 1), size.y).round(),\n\t\t\tsize: Math.round(randomRange(PARTICLES.minSize, PARTICLES.maxSize)),\n\t\t};\n\t\tparticles.push(newParticle);\n\t}\n\n\t// Move and render particles\n\tparticles.forEach((particle) => {\n\t\tparticle.position.y -= PARTICLES.fallSpeed;\n\n\t\t// Clean previous render\n\t\tfor (let i = 0; i < PARTICLES.fallSpeed; i++) {\n\t\t\tconst positionX = particle.position.x;\n\t\t\tconst positionY = particle.position.y + i + particle.size;\n\n\t\t\tif (positionY < size.y && positionY >= 0)\n\t\t\t\tscreen[positionY][positionX] = \" \";\n\t\t}\n\n\t\t// Remove offscreen particles\n\t\tif (particle.position.y + particle.size <= 0 || particle.position.x >= size.x)\n\t\t\treturn removeFromArray(particle, particles);\n\n\t\tfor (let i = 0; i < particle.size; i++) {\n\t\t\tconst character = randomFromArray(CHARACTERS.split(\"\"));\n\t\t\tlet color = i == 0 ? ANSI.fg.white : ANSI.fg.green;\n\n\t\t\tif (i > particle.size / 2)\n\t\t\t\tcolor = ANSI.fg.green + ANSI.decoration.dim;\n\n\t\t\tconst positionX = particle.position.x;\n\t\t\tconst positionY = particle.position.y + i;\n\n\t\t\tif (positionX < size.x && positionY < size.y && positionY >= 0) {\n\t\t\t\tscreen[positionY][positionX] = color + character + ANSI.reset;\n\t\t\t}\n\t\t}\n\t});\n\n\treturn [...screen.map((row) => row.join(\"\"))].reverse().join(\"\\n\");\n}\n\nexport const cmatrix = new Command()\n\t.setManual({\n\t\tpurpose: \"Show a scrolling 'Matrix' like screen\",\n\t\tusage: \"cmatrix\",\n\t})\n\t.setExecute(function(this: Command, _arguments, { size, stdin, stdout }) {\n\t\tconst particles: Particle[] = [];\n\n\t\t// Create screen\n\t\tlet screen = initializeScreen(size);\n\n\t\tconst delay = 100 / ANIMATION_SPEED;\n\n\t\treturn Shell.animate({\n\t\t\tstdin,\n\t\t\tstdout,\n\t\t\tdelay,\n\t\t\trender: (frame) => {\n\t\t\t\t// Re-initialize if terminal size changes\n\t\t\t\tif (screen.length !== size.y || (screen.length !== 0 ? screen[0].length : 0) !== size.x) {\n\t\t\t\t\tscreen = initializeScreen(size);\n\t\t\t\t}\n\n\t\t\t\treturn generateScreen(frame, screen, particles, size);\n\t\t\t},\n\t\t});\n\t});"],"names":["ANIMATION_SPEED","CHARACTERS","PARTICLES","initializeScreen","size","screen","y","row","x","generateScreen","frame","particles","framesBetweenSpawn","newParticle","Vector2","randomRange","particle","i","positionX","positionY","removeFromArray","character","randomFromArray","color","ANSI","cmatrix","Command","_arguments","stdin","stdout","delay","Shell"],"mappings":";;AAKA,MAAMA,IAAkB,MAClBC,IAAa,sFAEbC,IAAY;AAAA,EACjB,WAAW;AAAA,EACX,WAAW;AAAA,EACX,SAAS;AAAA,EACT,SAAS;AACV;AAOA,SAASC,EAAiBC,GAAe;AACxC,QAAMC,IAAqB,CAAA;AAC3B,WAASC,IAAI,GAAGA,IAAIF,EAAK,GAAGE,KAAK;AAChC,UAAMC,IAAgB,CAAA;AACtB,aAASC,IAAI,GAAGA,IAAIJ,EAAK,GAAGI;AAC3B,MAAAD,EAAI,KAAK,GAAG;AAEb,IAAAF,EAAO,KAAKE,CAAG;AAAA,EAChB;AACA,SAAOF;AACR;AAEA,SAASI,EAAeC,GAAeL,GAAoBM,GAAuBP,GAAuB;AACxG,QAAMQ,IAAqB,KAAK,MAAM,OAAQV,EAAU,YAAYE,EAAK,EAAE;AAG3E,MAAIQ,MAAuB,KAAKF,IAAQE,MAAuB,GAAG;AACjE,UAAMC,IAAwB;AAAA,MAC7B,UAAU,IAAIC,EAAQC,EAAY,GAAGX,EAAK,IAAI,CAAC,GAAGA,EAAK,CAAC,EAAE,MAAA;AAAA,MAC1D,MAAM,KAAK,MAAMW,EAAYb,EAAU,SAASA,EAAU,OAAO,CAAC;AAAA,IAAA;AAEnE,IAAAS,EAAU,KAAKE,CAAW;AAAA,EAC3B;AAGA,SAAAF,EAAU,QAAQ,CAACK,MAAa;AAC/B,IAAAA,EAAS,SAAS,KAAKd,EAAU;AAGjC,aAASe,IAAI,GAAGA,IAAIf,EAAU,WAAWe,KAAK;AAC7C,YAAMC,IAAYF,EAAS,SAAS,GAC9BG,IAAYH,EAAS,SAAS,IAAIC,IAAID,EAAS;AAErD,MAAIG,IAAYf,EAAK,KAAKe,KAAa,MACtCd,EAAOc,CAAS,EAAED,CAAS,IAAI;AAAA,IACjC;AAGA,QAAIF,EAAS,SAAS,IAAIA,EAAS,QAAQ,KAAKA,EAAS,SAAS,KAAKZ,EAAK;AAC3E,aAAOgB,EAAgBJ,GAAUL,CAAS;AAE3C,aAASM,IAAI,GAAGA,IAAID,EAAS,MAAMC,KAAK;AACvC,YAAMI,IAAYC,EAAgBrB,EAAW,MAAM,EAAE,CAAC;AACtD,UAAIsB,IAAQN,KAAK,IAAIO,EAAK,GAAG,QAAQA,EAAK,GAAG;AAE7C,MAAIP,IAAID,EAAS,OAAO,MACvBO,IAAQC,EAAK,GAAG,QAAQA,EAAK,WAAW;AAEzC,YAAMN,IAAYF,EAAS,SAAS,GAC9BG,IAAYH,EAAS,SAAS,IAAIC;AAExC,MAAIC,IAAYd,EAAK,KAAKe,IAAYf,EAAK,KAAKe,KAAa,MAC5Dd,EAAOc,CAAS,EAAED,CAAS,IAAIK,IAAQF,IAAYG,EAAK;AAAA,IAE1D;AAAA,EACD,CAAC,GAEM,CAAC,GAAGnB,EAAO,IAAI,CAACE,MAAQA,EAAI,KAAK,EAAE,CAAC,CAAC,EAAE,QAAA,EAAU,KAAK;AAAA,CAAI;AAClE;AAEO,MAAMkB,IAAU,IAAIC,EAAA,EACzB,UAAU;AAAA,EACV,SAAS;AAAA,EACT,OAAO;AACR,CAAC,EACA,WAAW,SAAwBC,GAAY,EAAE,MAAAvB,GAAM,OAAAwB,GAAO,QAAAC,KAAU;AACxE,QAAMlB,IAAwB,CAAA;AAG9B,MAAIN,IAASF,EAAiBC,CAAI;AAElC,QAAM0B,IAAQ,MAAM9B;AAEpB,SAAO+B,EAAM,QAAQ;AAAA,IACpB,OAAAH;AAAA,IACA,QAAAC;AAAA,IACA,OAAAC;AAAA,IACA,QAAQ,CAACpB,QAEJL,EAAO,WAAWD,EAAK,MAAMC,EAAO,WAAW,IAAIA,EAAO,CAAC,EAAE,SAAS,OAAOD,EAAK,OACrFC,IAASF,EAAiBC,CAAI,IAGxBK,EAAeC,GAAOL,GAAQM,GAAWP,CAAI;AAAA,EACrD,CACA;AACF,CAAC;"}
@@ -0,0 +1,11 @@
1
+ import { Command as a, CommandsManager as s } from "../main.js";
2
+ const i = new a().setManual({
3
+ purpose: "Display a list of all commands"
4
+ }).setRequireOptions(!0).setExecute(function(t, { options: e, stdout: n }) {
5
+ e.includes("c") && n.write(s.COMMANDS.map((o) => o.name).sort().join(`
6
+ `));
7
+ });
8
+ export {
9
+ i as compgen
10
+ };
11
+ //# sourceMappingURL=compgen-OhvISbst.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compgen-OhvISbst.js","sources":["../../src/features/shell/commands/compgen.ts"],"sourcesContent":["import { Command } from \"../command\";\nimport { CommandsManager } from \"../commands\";\n\nexport const compgen = new Command()\n\t.setManual({\n\t\tpurpose: \"Display a list of all commands\",\n\t})\n\t.setRequireOptions(true)\n\t.setExecute(function(_args, { options, stdout }) {\n\t\tif (options.includes(\"c\")) {\n\t\t\tstdout.write(CommandsManager.COMMANDS.map((command) => command.name).sort().join(\"\\n\"));\n\t\t}\n\t});"],"names":["compgen","Command","_args","options","stdout","CommandsManager","command"],"mappings":";AAGO,MAAMA,IAAU,IAAIC,EAAA,EACzB,UAAU;AAAA,EACV,SAAS;AACV,CAAC,EACA,kBAAkB,EAAI,EACtB,WAAW,SAASC,GAAO,EAAE,SAAAC,GAAS,QAAAC,KAAU;AAChD,EAAID,EAAQ,SAAS,GAAG,KACvBC,EAAO,MAAMC,EAAgB,SAAS,IAAI,CAACC,MAAYA,EAAQ,IAAI,EAAE,KAAA,EAAO,KAAK;AAAA,CAAI,CAAC;AAExF,CAAC;"}
@@ -0,0 +1,56 @@
1
+ import { Command as p, Shell as _, MAX_WIDTH as u } from "../main.js";
2
+ const w = `
3
+ \\ ^__^
4
+ \\ (oo)\\_______
5
+ (__)\\ )\\/\\
6
+ ||----w |
7
+ || ||`;
8
+ function m(f) {
9
+ const l = f.split(" "), s = [];
10
+ let n = "", i = 0;
11
+ const c = (e) => {
12
+ e = e.trimEnd(), s.push(e), e.length > i && (i = e.length);
13
+ }, a = (e) => {
14
+ c(n), n = e ? e + " " : "";
15
+ };
16
+ l.forEach((e) => {
17
+ if (e === "") {
18
+ n += " ";
19
+ return;
20
+ }
21
+ const t = e.split(`
22
+ `);
23
+ for (let o = 0; o < t.length; o++) {
24
+ const r = t[o];
25
+ if (o > 0 && a(), (n + r).length <= u)
26
+ n += r + " ";
27
+ else if (r.length > u) {
28
+ const h = u - n.length;
29
+ h >= 2 ? (c(n + r.substring(0, h - 1) + "-"), n = r.substring(h - 1) + " ") : a(r);
30
+ } else
31
+ a(r);
32
+ }
33
+ }), n.length > 0 && c(n);
34
+ const g = [` ${"_".repeat(i + 2)} `];
35
+ for (let e = 0; e < s.length; e++) {
36
+ let t = s[e];
37
+ const o = i - t.length;
38
+ o > 0 && (t += " ".repeat(o)), s.length > 1 ? e === 0 ? t = `/ ${t} \\` : e === s.length - 1 ? t = `\\ ${t} /` : t = `| ${t} |` : t = `< ${t} >`, g.push(t);
39
+ }
40
+ return g.push(` ${"-".repeat(i + 2)} `), g.join(`
41
+ `) + w + `
42
+ `;
43
+ }
44
+ const S = new p().setRequireArgs(!0).setManual({
45
+ purpose: "Show a cow saying something",
46
+ usage: "cowsay text",
47
+ description: "Show ASCII art of a cow saying something."
48
+ }).setExecute(function(f, { rawLine: l, stdout: s, stdin: n }) {
49
+ return _.readInput(l, n, (i) => {
50
+ s.write(m(i));
51
+ });
52
+ });
53
+ export {
54
+ S as cowsay
55
+ };
56
+ //# sourceMappingURL=cowsay-hTKzWScw.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cowsay-hTKzWScw.js","sources":["../../src/features/shell/commands/cowsay.ts"],"sourcesContent":["import { MAX_WIDTH } from \"../../../constants/shell.const\";\nimport { Command } from \"../command\";\nimport { Shell } from \"../shell\";\n\nconst COW = `\n \\\\ ^__^\n \\\\ (oo)\\\\_______\n (__)\\\\ )\\\\/\\\\\n ||----w |\n || ||`;\n\nfunction renderCowsay(text: string): string {\n\t// Separate input value into lines\n\tconst segments = text.split(\" \");\n\tconst lines: string[] = [];\n\tlet currentLine = \"\";\n\tlet maxLineWidth = 0;\n\n\tconst addLine = (line: string) => {\n\t\tline = line.trimEnd();\n\t\tlines.push(line);\n\t\tif (line.length > maxLineWidth)\n\t\t\tmaxLineWidth = line.length;\n\t};\n\n\tconst nextLine = (word?: string) => {\n\t\taddLine(currentLine);\n\t\tcurrentLine = word ? word + \" \" : \"\";\n\t};\n\n\tsegments.forEach((segment) => {\n\t\t// Add empty spaces preceding lines\n\t\tif (segment === \"\") {\n\t\t\tcurrentLine += \" \";\n\t\t\treturn;\n\t\t}\n\n\t\tconst words = segment.split(\"\\n\");\n\t\tfor (let i = 0; i < words.length; i++) {\n\t\t\tconst word = words[i];\n\n\t\t\t// Handle next lines\n\t\t\tif (i > 0)\n\t\t\t\tnextLine();\n\n\t\t\t// Fit word on current line\n\t\t\tif ((currentLine + word).length <= MAX_WIDTH) {\n\t\t\t\tcurrentLine += word + \" \";\n\t\t\t} else if (word.length > MAX_WIDTH) {\n\t\t\t\tconst remainingSpaces = MAX_WIDTH - currentLine.length;\n\n\t\t\t\tif (remainingSpaces >= 2) {\n\t\t\t\t\taddLine(currentLine + word.substring(0, remainingSpaces - 1) + \"-\");\n\t\t\t\t\tcurrentLine = word.substring(remainingSpaces - 1) + \" \";\n\t\t\t\t} else {\n\t\t\t\t\tnextLine(word);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tnextLine(word);\n\t\t\t}\n\t\t}\n\t});\n\n\tif (currentLine.length > 0)\n\t\taddLine(currentLine);\n\n\t// Turn lines into speech bubble\n\tconst speechBubble = [` ${\"_\".repeat(maxLineWidth + 2)} `];\n\t\n\tfor (let i = 0; i < lines.length; i++) {\n\t\tlet line = lines[i];\n\t\tconst missingSpaces = maxLineWidth - line.length;\n\n\t\tif (missingSpaces > 0)\n\t\t\tline += \" \".repeat(missingSpaces);\n\n\t\tif (lines.length > 1) {\n\t\t\tif (i === 0) {\n\t\t\t\tline = `/ ${line} \\\\`;\n\t\t\t} else if (i === lines.length - 1) {\n\t\t\t\tline = `\\\\ ${line} /`;\n\t\t\t} else {\n\t\t\t\tline = `| ${line} |`;\n\t\t\t}\n\t\t} else {\n\t\t\tline = `< ${line} >`;\n\t\t}\n\n\t\tspeechBubble.push(line);\n\t}\n\n\tspeechBubble.push(` ${\"-\".repeat(maxLineWidth + 2)} `);\n\n\treturn speechBubble.join(\"\\n\") + COW + \"\\n\";\n}\n\nexport const cowsay = new Command()\n\t.setRequireArgs(true)\n\t.setManual({\n\t\tpurpose: \"Show a cow saying something\",\n\t\tusage: \"cowsay text\",\n\t\tdescription: \"Show ASCII art of a cow saying something.\",\n\t})\n\t.setExecute(function(_args, { rawLine, stdout, stdin }) {\n\t\treturn Shell.readInput(rawLine, stdin, (text) => {\n\t\t\tstdout.write(renderCowsay(text));\n\t\t});\n\t});"],"names":["COW","renderCowsay","text","segments","lines","currentLine","maxLineWidth","addLine","line","nextLine","word","segment","words","i","MAX_WIDTH","remainingSpaces","speechBubble","missingSpaces","cowsay","Command","_args","rawLine","stdout","stdin","Shell"],"mappings":";AAIA,MAAMA,IAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAOZ,SAASC,EAAaC,GAAsB;AAE3C,QAAMC,IAAWD,EAAK,MAAM,GAAG,GACzBE,IAAkB,CAAA;AACxB,MAAIC,IAAc,IACdC,IAAe;AAEnB,QAAMC,IAAU,CAACC,MAAiB;AACjC,IAAAA,IAAOA,EAAK,QAAA,GACZJ,EAAM,KAAKI,CAAI,GACXA,EAAK,SAASF,MACjBA,IAAeE,EAAK;AAAA,EACtB,GAEMC,IAAW,CAACC,MAAkB;AACnC,IAAAH,EAAQF,CAAW,GACnBA,IAAcK,IAAOA,IAAO,MAAM;AAAA,EACnC;AAEA,EAAAP,EAAS,QAAQ,CAACQ,MAAY;AAE7B,QAAIA,MAAY,IAAI;AACnB,MAAAN,KAAe;AACf;AAAA,IACD;AAEA,UAAMO,IAAQD,EAAQ,MAAM;AAAA,CAAI;AAChC,aAASE,IAAI,GAAGA,IAAID,EAAM,QAAQC,KAAK;AACtC,YAAMH,IAAOE,EAAMC,CAAC;AAOpB,UAJIA,IAAI,KACPJ,EAAA,IAGIJ,IAAcK,GAAM,UAAUI;AAClC,QAAAT,KAAeK,IAAO;AAAA,eACZA,EAAK,SAASI,GAAW;AACnC,cAAMC,IAAkBD,IAAYT,EAAY;AAEhD,QAAIU,KAAmB,KACtBR,EAAQF,IAAcK,EAAK,UAAU,GAAGK,IAAkB,CAAC,IAAI,GAAG,GAClEV,IAAcK,EAAK,UAAUK,IAAkB,CAAC,IAAI,OAEpDN,EAASC,CAAI;AAAA,MAEf;AACC,QAAAD,EAASC,CAAI;AAAA,IAEf;AAAA,EACD,CAAC,GAEGL,EAAY,SAAS,KACxBE,EAAQF,CAAW;AAGpB,QAAMW,IAAe,CAAC,IAAI,IAAI,OAAOV,IAAe,CAAC,CAAC,GAAG;AAEzD,WAASO,IAAI,GAAGA,IAAIT,EAAM,QAAQS,KAAK;AACtC,QAAIL,IAAOJ,EAAMS,CAAC;AAClB,UAAMI,IAAgBX,IAAeE,EAAK;AAE1C,IAAIS,IAAgB,MACnBT,KAAQ,IAAI,OAAOS,CAAa,IAE7Bb,EAAM,SAAS,IACdS,MAAM,IACTL,IAAO,KAAKA,CAAI,QACNK,MAAMT,EAAM,SAAS,IAC/BI,IAAO,MAAMA,CAAI,OAEjBA,IAAO,KAAKA,CAAI,OAGjBA,IAAO,KAAKA,CAAI,MAGjBQ,EAAa,KAAKR,CAAI;AAAA,EACvB;AAEA,SAAAQ,EAAa,KAAK,IAAI,IAAI,OAAOV,IAAe,CAAC,CAAC,GAAG,GAE9CU,EAAa,KAAK;AAAA,CAAI,IAAIhB,IAAM;AAAA;AACxC;AAEO,MAAMkB,IAAS,IAAIC,EAAA,EACxB,eAAe,EAAI,EACnB,UAAU;AAAA,EACV,SAAS;AAAA,EACT,OAAO;AAAA,EACP,aAAa;AACd,CAAC,EACA,WAAW,SAASC,GAAO,EAAE,SAAAC,GAAS,QAAAC,GAAQ,OAAAC,KAAS;AACvD,SAAOC,EAAM,UAAUH,GAASE,GAAO,CAACrB,MAAS;AAChD,IAAAoB,EAAO,MAAMrB,EAAaC,CAAI,CAAC;AAAA,EAChC,CAAC;AACF,CAAC;"}
@@ -0,0 +1,33 @@
1
+ import { Command as U } from "../main.js";
2
+ const h = new U().setManual({
3
+ purpose: "Display or set the date and time",
4
+ usage: "date [option] [+format]",
5
+ description: "Display the current time in the given FORMAT.",
6
+ options: {
7
+ "-u": "Display UTC (Coordinated Universal Time)"
8
+ }
9
+ }).addOption({ short: "u", long: "utc" }).setExecute(function(p, { stdout: r, options: m }) {
10
+ const t = /* @__PURE__ */ new Date(), n = m.includes("u"), i = p.find((o) => o.startsWith("+"));
11
+ if (!i) {
12
+ r.write(n ? t.toUTCString() : t.toString());
13
+ return;
14
+ }
15
+ const e = (o) => o.toString().padStart(2, "0"), a = n ? t.getUTCFullYear() : t.getFullYear(), c = (n ? t.getUTCMonth() : t.getMonth()) + 1, u = n ? t.getUTCDate() : t.getDate(), g = n ? t.getUTCHours() : t.getHours(), d = n ? t.getUTCMinutes() : t.getMinutes(), l = n ? t.getUTCSeconds() : t.getSeconds(), T = {
16
+ "%Y": a.toString(),
17
+ "%m": e(c),
18
+ "%d": e(u),
19
+ "%H": e(g),
20
+ "%M": e(d),
21
+ "%S": e(l),
22
+ "%T": `${e(g)}:${e(d)}:${e(l)}`,
23
+ "%D": `${e(c)}/${e(u)}/${a.toString().slice(-2)}`
24
+ };
25
+ let s = i.substring(1);
26
+ for (const [o, C] of Object.entries(T))
27
+ s = s.replaceAll(o, C);
28
+ r.write(s);
29
+ });
30
+ export {
31
+ h as date
32
+ };
33
+ //# sourceMappingURL=date-D8cnHZuY.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-D8cnHZuY.js","sources":["../../src/features/shell/commands/date.ts"],"sourcesContent":["import { Command } from \"../command\";\n\nexport const date = new Command()\n\t.setManual({\n\t\tpurpose: \"Display or set the date and time\",\n\t\tusage: \"date [option] [+format]\",\n\t\tdescription: \"Display the current time in the given FORMAT.\",\n\t\toptions: {\n\t\t\t\"-u\": \"Display UTC (Coordinated Universal Time)\",\n\t\t},\n\t})\n\t.addOption({ short: \"u\", long: \"utc\" })\n\t.setExecute(function(this: Command, args, { stdout, options }) {\n\t\tconst now = new Date();\n\t\tconst isUtc = options.includes(\"u\");\n\t\tconst formatArgument = args.find((arg) => arg.startsWith(\"+\"));\n\n\t\tif (!formatArgument) {\n\t\t\tstdout.write(isUtc ? now.toUTCString() : now.toString());\n\t\t\treturn;\n\t\t}\n\n\t\tconst pad = (value: number) => value.toString().padStart(2, \"0\");\n\n\t\tconst year = isUtc ? now.getUTCFullYear() : now.getFullYear();\n\t\tconst month = (isUtc ? now.getUTCMonth() : now.getMonth()) + 1;\n\t\tconst day = isUtc ? now.getUTCDate() : now.getDate();\n\t\tconst hours = isUtc ? now.getUTCHours() : now.getHours();\n\t\tconst minutes = isUtc ? now.getUTCMinutes() : now.getMinutes();\n\t\tconst seconds = isUtc ? now.getUTCSeconds() : now.getSeconds();\n\n\t\tconst formatMap: Record<string, string> = {\n\t\t\t\"%Y\": year.toString(),\n\t\t\t\"%m\": pad(month),\n\t\t\t\"%d\": pad(day),\n\t\t\t\"%H\": pad(hours),\n\t\t\t\"%M\": pad(minutes),\n\t\t\t\"%S\": pad(seconds),\n\t\t\t\"%T\": `${pad(hours)}:${pad(minutes)}:${pad(seconds)}`,\n\t\t\t\"%D\": `${pad(month)}/${pad(day)}/${year.toString().slice(-2)}`,\n\t\t};\n\n\t\tlet result = formatArgument.substring(1);\n\n\t\tfor (const [key, value] of Object.entries(formatMap)) {\n\t\t\tresult = result.replaceAll(key, value);\n\t\t}\n\n\t\tstdout.write(result);\n\t});"],"names":["date","Command","args","stdout","options","now","isUtc","formatArgument","arg","pad","value","year","month","day","hours","minutes","seconds","formatMap","result","key"],"mappings":";AAEO,MAAMA,IAAO,IAAIC,EAAA,EACtB,UAAU;AAAA,EACV,SAAS;AAAA,EACT,OAAO;AAAA,EACP,aAAa;AAAA,EACb,SAAS;AAAA,IACR,MAAM;AAAA,EAAA;AAER,CAAC,EACA,UAAU,EAAE,OAAO,KAAK,MAAM,OAAO,EACrC,WAAW,SAAwBC,GAAM,EAAE,QAAAC,GAAQ,SAAAC,KAAW;AAC9D,QAAMC,wBAAU,KAAA,GACVC,IAAQF,EAAQ,SAAS,GAAG,GAC5BG,IAAiBL,EAAK,KAAK,CAACM,MAAQA,EAAI,WAAW,GAAG,CAAC;AAE7D,MAAI,CAACD,GAAgB;AACpB,IAAAJ,EAAO,MAAMG,IAAQD,EAAI,gBAAgBA,EAAI,UAAU;AACvD;AAAA,EACD;AAEA,QAAMI,IAAM,CAACC,MAAkBA,EAAM,WAAW,SAAS,GAAG,GAAG,GAEzDC,IAAOL,IAAQD,EAAI,eAAA,IAAmBA,EAAI,YAAA,GAC1CO,KAASN,IAAQD,EAAI,gBAAgBA,EAAI,cAAc,GACvDQ,IAAMP,IAAQD,EAAI,WAAA,IAAeA,EAAI,QAAA,GACrCS,IAAQR,IAAQD,EAAI,YAAA,IAAgBA,EAAI,SAAA,GACxCU,IAAUT,IAAQD,EAAI,cAAA,IAAkBA,EAAI,WAAA,GAC5CW,IAAUV,IAAQD,EAAI,cAAA,IAAkBA,EAAI,WAAA,GAE5CY,IAAoC;AAAA,IACzC,MAAMN,EAAK,SAAA;AAAA,IACX,MAAMF,EAAIG,CAAK;AAAA,IACf,MAAMH,EAAII,CAAG;AAAA,IACb,MAAMJ,EAAIK,CAAK;AAAA,IACf,MAAML,EAAIM,CAAO;AAAA,IACjB,MAAMN,EAAIO,CAAO;AAAA,IACjB,MAAM,GAAGP,EAAIK,CAAK,CAAC,IAAIL,EAAIM,CAAO,CAAC,IAAIN,EAAIO,CAAO,CAAC;AAAA,IACnD,MAAM,GAAGP,EAAIG,CAAK,CAAC,IAAIH,EAAII,CAAG,CAAC,IAAIF,EAAK,SAAA,EAAW,MAAM,EAAE,CAAC;AAAA,EAAA;AAG7D,MAAIO,IAASX,EAAe,UAAU,CAAC;AAEvC,aAAW,CAACY,GAAKT,CAAK,KAAK,OAAO,QAAQO,CAAS;AAClD,IAAAC,IAASA,EAAO,WAAWC,GAAKT,CAAK;AAGtC,EAAAP,EAAO,MAAMe,CAAM;AACpB,CAAC;"}
@@ -0,0 +1,11 @@
1
+ import { Command as n } from "../main.js";
2
+ const c = new n().setManual({
3
+ purpose: "List all directories in the current directory"
4
+ }).setExecute(function(s, { workingDirectory: t, stdout: o }) {
5
+ const r = t.subFolders.map((e) => e.id);
6
+ r.length !== 0 && o.write(r.sort((e, i) => e.localeCompare(i)).join(" "));
7
+ });
8
+ export {
9
+ c as dir
10
+ };
11
+ //# sourceMappingURL=dir-BmNeEPzy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dir-BmNeEPzy.js","sources":["../../src/features/shell/commands/dir.ts"],"sourcesContent":["import { Command } from \"../command\";\n\nexport const dir = new Command()\n\t.setManual({\n\t\tpurpose: \"List all directories in the current directory\",\n\t})\n\t.setExecute(function(_args, { workingDirectory, stdout }) {\n\t\tconst folderNames = workingDirectory.subFolders.map((folder) => folder.id);\n\t\n\t\tif (folderNames.length === 0)\n\t\t\treturn;\n\t\n\t\tstdout.write(folderNames.sort((nameA, nameB) => nameA.localeCompare(nameB)).join(\" \"));\n\t});"],"names":["dir","Command","_args","workingDirectory","stdout","folderNames","folder","nameA","nameB"],"mappings":";AAEO,MAAMA,IAAM,IAAIC,EAAA,EACrB,UAAU;AAAA,EACV,SAAS;AACV,CAAC,EACA,WAAW,SAASC,GAAO,EAAE,kBAAAC,GAAkB,QAAAC,KAAU;AACzD,QAAMC,IAAcF,EAAiB,WAAW,IAAI,CAACG,MAAWA,EAAO,EAAE;AAEzE,EAAID,EAAY,WAAW,KAG3BD,EAAO,MAAMC,EAAY,KAAK,CAACE,GAAOC,MAAUD,EAAM,cAAcC,CAAK,CAAC,EAAE,KAAK,GAAG,CAAC;AACtF,CAAC;"}
@@ -0,0 +1,17 @@
1
+ import { Command as s } from "../main.js";
2
+ const p = new s().setManual({
3
+ purpose: "Display a line of text",
4
+ usage: "echo [option] [string ...]",
5
+ description: "Write arguments to the standard output.",
6
+ options: {
7
+ "-n": "Do not output the trailing newline"
8
+ }
9
+ }).addOption({ short: "n", long: "no-newline", isInput: !1 }).setExecute(function(n, { stdout: t, options: o }) {
10
+ const e = n.join(" "), i = o.includes("n") ? "" : `
11
+ `;
12
+ t.write(e + i);
13
+ });
14
+ export {
15
+ p as echo
16
+ };
17
+ //# sourceMappingURL=echo-Gmh-b8f5.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"echo-Gmh-b8f5.js","sources":["../../src/features/shell/commands/echo.ts"],"sourcesContent":["import { Command } from \"../command\";\n\nexport const echo = new Command()\n\t.setManual({\n\t\tpurpose: \"Display a line of text\",\n\t\tusage: \"echo [option] [string ...]\",\n\t\tdescription: \"Write arguments to the standard output.\",\n\t\toptions: {\n\t\t\t\"-n\": \"Do not output the trailing newline\",\n\t\t},\n\t})\n\t.addOption({ short: \"n\", long: \"no-newline\", isInput: false })\n\t.setExecute(function(this: Command, args, { stdout, options }) {\n\t\tconst output = args.join(\" \");\n\t\tconst ending = options.includes(\"n\") ? \"\" : \"\\n\";\n\n\t\tstdout.write(output + ending);\n\t});"],"names":["echo","Command","args","stdout","options","output","ending"],"mappings":";AAEO,MAAMA,IAAO,IAAIC,EAAA,EACtB,UAAU;AAAA,EACV,SAAS;AAAA,EACT,OAAO;AAAA,EACP,aAAa;AAAA,EACb,SAAS;AAAA,IACR,MAAM;AAAA,EAAA;AAER,CAAC,EACA,UAAU,EAAE,OAAO,KAAK,MAAM,cAAc,SAAS,GAAA,CAAO,EAC5D,WAAW,SAAwBC,GAAM,EAAE,QAAAC,GAAQ,SAAAC,KAAW;AAC9D,QAAMC,IAASH,EAAK,KAAK,GAAG,GACtBI,IAASF,EAAQ,SAAS,GAAG,IAAI,KAAK;AAAA;AAE5C,EAAAD,EAAO,MAAME,IAASC,CAAM;AAC7B,CAAC;"}
@@ -0,0 +1,24 @@
1
+ import { Command as a, EXIT_CODE as u, Shell as i } from "../main.js";
2
+ const l = new a().setRequireArgs(!0).setManual({
3
+ purpose: "Evaluate and execute JavaScript code",
4
+ usage: "eval [input]",
5
+ description: "Executes JavaScript code with access to the shell."
6
+ }).setExecute(function(n, r) {
7
+ const { stdout: s, stderr: o } = r, c = n.join(" ");
8
+ try {
9
+ const e = new Function("context", `
10
+ with(context) {
11
+ return (${c});
12
+ }
13
+ `)(r);
14
+ return e !== void 0 && s.write(String(e)), u.success;
15
+ } catch (t) {
16
+ const e = t instanceof Error ? t.message : "Execution error";
17
+ return i.writeError(o, this.name, e);
18
+ }
19
+ });
20
+ export {
21
+ l as eval,
22
+ l as evalCommand
23
+ };
24
+ //# sourceMappingURL=eval-DINS_Vhl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eval-DINS_Vhl.js","sources":["../../src/features/shell/commands/eval.ts"],"sourcesContent":["import { EXIT_CODE } from \"../../../constants\";\nimport { Command } from \"../command\";\nimport { Shell, ShellContext } from \"../shell\";\n\nexport const evalCommand = new Command()\n\t.setRequireArgs(true)\n\t.setManual({\n\t\tpurpose: \"Evaluate and execute JavaScript code\",\n\t\tusage: \"eval [input]\",\n\t\tdescription: \"Executes JavaScript code with access to the shell.\",\n\t})\n\t.setExecute(function(this: Command, args, context) {\n\t\tconst { stdout, stderr } = context;\n\t\tconst code = args.join(\" \");\n\n\t\ttry {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-implied-eval\n\t\t\tconst runner = new Function(\"context\", `\n\t\t\t\twith(context) { \n\t\t\t\t\treturn (${code}); \n\t\t\t\t}\n\t\t\t`) as (context: ShellContext) => unknown;\n\n\t\t\tconst result = runner(context);\n\n\t\t\tif (result !== undefined) {\n\t\t\t\tstdout.write(String(result as unknown));\n\t\t\t}\n\n\t\t\treturn EXIT_CODE.success;\n\t\t} catch (error) {\n\t\t\tconst message = error instanceof Error ? error.message : \"Execution error\";\n\t\t\treturn Shell.writeError(stderr, this.name, message);\n\t\t}\n\t});\n\nexport { evalCommand as eval };"],"names":["evalCommand","Command","args","context","stdout","stderr","code","result","EXIT_CODE","error","message","Shell"],"mappings":";AAIO,MAAMA,IAAc,IAAIC,EAAA,EAC7B,eAAe,EAAI,EACnB,UAAU;AAAA,EACV,SAAS;AAAA,EACT,OAAO;AAAA,EACP,aAAa;AACd,CAAC,EACA,WAAW,SAAwBC,GAAMC,GAAS;AAClD,QAAM,EAAE,QAAAC,GAAQ,QAAAC,EAAA,IAAWF,GACrBG,IAAOJ,EAAK,KAAK,GAAG;AAE1B,MAAI;AAQH,UAAMK,IANS,IAAI,SAAS,WAAW;AAAA;AAAA,eAE3BD,CAAI;AAAA;AAAA,IAEf,EAEqBH,CAAO;AAE7B,WAAII,MAAW,UACdH,EAAO,MAAM,OAAOG,CAAiB,CAAC,GAGhCC,EAAU;AAAA,EAClB,SAASC,GAAO;AACf,UAAMC,IAAUD,aAAiB,QAAQA,EAAM,UAAU;AACzD,WAAOE,EAAM,WAAWN,GAAQ,KAAK,MAAMK,CAAO;AAAA,EACnD;AACD,CAAC;"}
@@ -0,0 +1,10 @@
1
+ import { Command as t } from "../main.js";
2
+ const o = new t().setManual({
3
+ purpose: "Quit terminal interface"
4
+ }).setExecute(function(n, { exit: e }) {
5
+ e();
6
+ });
7
+ export {
8
+ o as exit
9
+ };
10
+ //# sourceMappingURL=exit-w3PqRkwA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exit-w3PqRkwA.js","sources":["../../src/features/shell/commands/exit.ts"],"sourcesContent":["import { Command } from \"../command\";\n\nexport const exit = new Command()\n\t.setManual({\n\t\tpurpose: \"Quit terminal interface\",\n\t})\n\t.setExecute(function(_args, { exit }) {\n\t\texit();\n\t});"],"names":["exit","Command","_args"],"mappings":";AAEO,MAAMA,IAAO,IAAIC,EAAA,EACtB,UAAU;AAAA,EACV,SAAS;AACV,CAAC,EACA,WAAW,SAASC,GAAO,EAAE,MAAAF,KAAQ;AACrCA,EAAAA,EAAAA;AACD,CAAC;"}
@@ -0,0 +1,59 @@
1
+ import { randomFromArray as o } from "@prozilla-os/shared";
2
+ import { Command as t } from "../main.js";
3
+ const a = [
4
+ "Do not be afraid of competition.",
5
+ "An exciting opportunity lies ahead of you.",
6
+ "You love peace.",
7
+ "Get your mind set... confidence will lead you on.",
8
+ "You will always be surrounded by true friends.",
9
+ "Sell your ideas-they have exceptional merit.",
10
+ "You should be able to undertake and complete anything.",
11
+ "You are kind and friendly.",
12
+ "You are wise beyond your years.",
13
+ "Your ability to juggle many tasks will take you far.",
14
+ "A routine task will turn into an enchanting adventure.",
15
+ "Beware of all enterprises that require new clothes.",
16
+ "Be true to your work, your word, and your friend.",
17
+ "Goodness is the only investment that never fails.",
18
+ "A journey of a thousand miles begins with a single step.",
19
+ "Forget injuries; never forget kindnesses.",
20
+ "Respect yourself and others will respect you.",
21
+ "A man cannot be comfortable without his own approval.",
22
+ "Always do right. This will gratify some people and astonish the rest.",
23
+ "It is easier to stay out than to get out.",
24
+ "Sing everyday and chase the mean blues away.",
25
+ "You will receive money from an unexpected source.",
26
+ "Attitude is a little thing that makes a big difference.",
27
+ "Plan for many pleasures ahead.",
28
+ "Experience is the best teacher.",
29
+ "You will be happy with your spouse.",
30
+ "Expect the unexpected.",
31
+ "Stay healthy. Walk a mile.",
32
+ "The family that plays together stays together.",
33
+ "Eat chocolate to have a sweeter life.",
34
+ "Once you make a decision the universe conspires to make it happen.",
35
+ "Make yourself necessary to someone.",
36
+ "The only way to have a friend is to be one.",
37
+ "Nothing great was ever achieved without enthusiasm.",
38
+ "Dance as if no one is watching.",
39
+ "Live this day as if it were your last.",
40
+ "Your life will be happy and peaceful.",
41
+ "Reach for joy and all else will follow.",
42
+ "Move in the direction of your dreams.",
43
+ "Bloom where you are planted.",
44
+ "Appreciate. Appreciate. Appreciate.",
45
+ "Happy News is on its way.",
46
+ "A closed mouth gathers no feet.",
47
+ "He who throws dirt is losing ground.",
48
+ "Borrow money from a pessimist. They don't expect it back.",
49
+ "Life is what happens to you while you are busy making other plans.",
50
+ "Help! I'm being held prisoner in a fortune cookie factory."
51
+ ], s = new t().setManual({
52
+ purpose: "Tell fortune"
53
+ }).setExecute(function(i, { stdout: e }) {
54
+ e.write(o(a));
55
+ });
56
+ export {
57
+ s as fortune
58
+ };
59
+ //# sourceMappingURL=fortune-DkIZpYa_.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fortune-DkIZpYa_.js","sources":["../../src/features/shell/commands/fortune.ts"],"sourcesContent":["import { randomFromArray } from \"@prozilla-os/shared\";\nimport { Command } from \"../command\";\n\n/**\n * @see [Source](https://github.com/shlomif/fortune-mod/blob/master/fortune-mod/datfiles/fortunes)\n */\nconst FORTUNES = [\n\t\"Do not be afraid of competition.\",\n\t\"An exciting opportunity lies ahead of you.\",\n\t\"You love peace.\",\n\t\"Get your mind set... confidence will lead you on.\",\n\t\"You will always be surrounded by true friends.\",\n\t\"Sell your ideas-they have exceptional merit.\",\n\t\"You should be able to undertake and complete anything.\",\n\t\"You are kind and friendly.\",\n\t\"You are wise beyond your years.\",\n\t\"Your ability to juggle many tasks will take you far.\",\n\t\"A routine task will turn into an enchanting adventure.\",\n\t\"Beware of all enterprises that require new clothes.\",\n\t\"Be true to your work, your word, and your friend.\",\n\t\"Goodness is the only investment that never fails.\",\n\t\"A journey of a thousand miles begins with a single step.\",\n\t\"Forget injuries; never forget kindnesses.\",\n\t\"Respect yourself and others will respect you.\",\n\t\"A man cannot be comfortable without his own approval.\",\n\t\"Always do right. This will gratify some people and astonish the rest.\",\n\t\"It is easier to stay out than to get out.\",\n\t\"Sing everyday and chase the mean blues away.\",\n\t\"You will receive money from an unexpected source.\",\n\t\"Attitude is a little thing that makes a big difference.\",\n\t\"Plan for many pleasures ahead.\",\n\t\"Experience is the best teacher.\",\n\t\"You will be happy with your spouse.\",\n\t\"Expect the unexpected.\",\n\t\"Stay healthy. Walk a mile.\",\n\t\"The family that plays together stays together.\",\n\t\"Eat chocolate to have a sweeter life.\",\n\t\"Once you make a decision the universe conspires to make it happen.\",\n\t\"Make yourself necessary to someone.\",\n\t\"The only way to have a friend is to be one.\",\n\t\"Nothing great was ever achieved without enthusiasm.\",\n\t\"Dance as if no one is watching.\",\n\t\"Live this day as if it were your last.\",\n\t\"Your life will be happy and peaceful.\",\n\t\"Reach for joy and all else will follow.\",\n\t\"Move in the direction of your dreams.\",\n\t\"Bloom where you are planted.\",\n\t\"Appreciate. Appreciate. Appreciate.\",\n\t\"Happy News is on its way.\",\n\t\"A closed mouth gathers no feet.\",\n\t\"He who throws dirt is losing ground.\",\n\t\"Borrow money from a pessimist. They don't expect it back.\",\n\t\"Life is what happens to you while you are busy making other plans.\",\n\t\"Help! I'm being held prisoner in a fortune cookie factory.\",\n];\n\nexport const fortune = new Command()\n\t.setManual({\n\t\tpurpose: \"Tell fortune\",\n\t})\n\t.setExecute(function(_args, { stdout }) {\n\t\tstdout.write(randomFromArray(FORTUNES));\n\t});"],"names":["FORTUNES","fortune","Command","_args","stdout","randomFromArray"],"mappings":";;AAMA,MAAMA,IAAW;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAEaC,IAAU,IAAIC,EAAA,EACzB,UAAU;AAAA,EACV,SAAS;AACV,CAAC,EACA,WAAW,SAASC,GAAO,EAAE,QAAAC,KAAU;AACvC,EAAAA,EAAO,MAAMC,EAAgBL,CAAQ,CAAC;AACvC,CAAC;"}
@@ -0,0 +1,41 @@
1
+ import { Command as w, Shell as o, EXIT_CODE as h } from "../main.js";
2
+ const I = new w().setManual({
3
+ purpose: "Search for patterns in text",
4
+ usage: "grep [option...] pattern [file...]",
5
+ description: "Search for PATTERN in each FILE.",
6
+ options: {
7
+ "-i": "Ignore case distinctions",
8
+ "-v": "Invert match: select non-matching lines",
9
+ "-n": "Print line number with output lines"
10
+ }
11
+ }).addOption({ short: "i", long: "ignore-case" }).addOption({ short: "v", long: "invert-match" }).addOption({ short: "n", long: "line-number" }).setExecute(async function(c, { stdout: f, stderr: a, stdin: p, workingDirectory: d, options: i }) {
12
+ if (!c.length)
13
+ return o.writeError(a, this.name, "Pattern is required");
14
+ const [m, ...r] = c, g = new RegExp(m, i.includes("i") ? "i" : ""), l = (e, t) => {
15
+ e.split(`
16
+ `).forEach((n, E) => {
17
+ const u = g.test(n);
18
+ if (i.includes("v") ? !u : u) {
19
+ let s = "";
20
+ t && r.length > 1 && (s += `${t}:`), i.includes("n") && (s += `${E + 1}:`), f.write(s + n);
21
+ }
22
+ });
23
+ };
24
+ if (r.length > 0) {
25
+ for (const e of r) {
26
+ const t = d.navigateToFile(e);
27
+ if (!t) {
28
+ o.writeError(a, this.name, `${e}: No such file`);
29
+ continue;
30
+ }
31
+ const n = await t.read();
32
+ n != null && l(n, e);
33
+ }
34
+ return h.success;
35
+ }
36
+ return o.readInput("", p, (e) => (l(e), h.success));
37
+ });
38
+ export {
39
+ I as grep
40
+ };
41
+ //# sourceMappingURL=grep-CR3FMStR.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grep-CR3FMStR.js","sources":["../../src/features/shell/commands/grep.ts"],"sourcesContent":["import { EXIT_CODE } from \"../../../constants\";\nimport { Command } from \"../command\";\nimport { Shell } from \"../shell\";\n\nexport const grep = new Command()\n\t.setManual({\n\t\tpurpose: \"Search for patterns in text\",\n\t\tusage: \"grep [option...] pattern [file...]\",\n\t\tdescription: \"Search for PATTERN in each FILE.\",\n\t\toptions: {\n\t\t\t\"-i\": \"Ignore case distinctions\",\n\t\t\t\"-v\": \"Invert match: select non-matching lines\",\n\t\t\t\"-n\": \"Print line number with output lines\",\n\t\t},\n\t})\n\t.addOption({ short: \"i\", long: \"ignore-case\" })\n\t.addOption({ short: \"v\", long: \"invert-match\" })\n\t.addOption({ short: \"n\", long: \"line-number\" })\n\t.setExecute(async function(this: Command, args, { stdout, stderr, stdin, workingDirectory, options }) {\n\t\tif (!args.length)\n\t\t\treturn Shell.writeError(stderr, this.name, \"Pattern is required\");\n\n\t\tconst [pattern, ...fileNames] = args;\n\t\tconst regex = new RegExp(pattern, options.includes(\"i\") ? \"i\" : \"\");\n\n\t\tconst search = (text: string, origin?: string) => {\n\t\t\ttext.split(\"\\n\").forEach((line, index) => {\n\t\t\t\tconst match = regex.test(line);\n\t\t\t\tconst shouldMatch = options.includes(\"v\") ? !match : match;\n\n\t\t\t\tif (shouldMatch) {\n\t\t\t\t\tlet prefix = \"\";\n\t\t\t\t\tif (origin && fileNames.length > 1) prefix += `${origin}:`;\n\t\t\t\t\tif (options.includes(\"n\")) prefix += `${index + 1}:`;\n\t\t\t\t\tstdout.write(prefix + line);\n\t\t\t\t}\n\t\t\t});\n\t\t};\n\n\t\tif (fileNames.length > 0) {\n\t\t\tfor (const name of fileNames) {\n\t\t\t\tconst file = workingDirectory.navigateToFile(name);\n\t\t\t\tif (!file) {\n\t\t\t\t\tShell.writeError(stderr, this.name, `${name}: No such file`);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n \n\t\t\t\tconst text = await file.read();\n\t\t\t\tif (text != null)\n\t\t\t\t\tsearch(text, name);\n\t\t\t}\n\t\t\treturn EXIT_CODE.success;\n\t\t}\n\n\t\treturn Shell.readInput(\"\", stdin, (data) => {\n\t\t\tsearch(data);\n\t\t\treturn EXIT_CODE.success;\n\t\t});\n\t});"],"names":["grep","Command","args","stdout","stderr","stdin","workingDirectory","options","Shell","pattern","fileNames","regex","search","text","origin","line","index","match","prefix","name","file","EXIT_CODE","data"],"mappings":";AAIO,MAAMA,IAAO,IAAIC,EAAA,EACtB,UAAU;AAAA,EACV,SAAS;AAAA,EACT,OAAO;AAAA,EACP,aAAa;AAAA,EACb,SAAS;AAAA,IACR,MAAM;AAAA,IACN,MAAM;AAAA,IACN,MAAM;AAAA,EAAA;AAER,CAAC,EACA,UAAU,EAAE,OAAO,KAAK,MAAM,cAAA,CAAe,EAC7C,UAAU,EAAE,OAAO,KAAK,MAAM,gBAAgB,EAC9C,UAAU,EAAE,OAAO,KAAK,MAAM,cAAA,CAAe,EAC7C,WAAW,eAA8BC,GAAM,EAAE,QAAAC,GAAQ,QAAAC,GAAQ,OAAAC,GAAO,kBAAAC,GAAkB,SAAAC,KAAW;AACrG,MAAI,CAACL,EAAK;AACT,WAAOM,EAAM,WAAWJ,GAAQ,KAAK,MAAM,qBAAqB;AAEjE,QAAM,CAACK,GAAS,GAAGC,CAAS,IAAIR,GAC1BS,IAAQ,IAAI,OAAOF,GAASF,EAAQ,SAAS,GAAG,IAAI,MAAM,EAAE,GAE5DK,IAAS,CAACC,GAAcC,MAAoB;AACjD,IAAAD,EAAK,MAAM;AAAA,CAAI,EAAE,QAAQ,CAACE,GAAMC,MAAU;AACzC,YAAMC,IAAQN,EAAM,KAAKI,CAAI;AAG7B,UAFoBR,EAAQ,SAAS,GAAG,IAAI,CAACU,IAAQA,GAEpC;AAChB,YAAIC,IAAS;AACb,QAAIJ,KAAUJ,EAAU,SAAS,MAAGQ,KAAU,GAAGJ,CAAM,MACnDP,EAAQ,SAAS,GAAG,MAAGW,KAAU,GAAGF,IAAQ,CAAC,MACjDb,EAAO,MAAMe,IAASH,CAAI;AAAA,MAC3B;AAAA,IACD,CAAC;AAAA,EACF;AAEA,MAAIL,EAAU,SAAS,GAAG;AACzB,eAAWS,KAAQT,GAAW;AAC7B,YAAMU,IAAOd,EAAiB,eAAea,CAAI;AACjD,UAAI,CAACC,GAAM;AACV,QAAAZ,EAAM,WAAWJ,GAAQ,KAAK,MAAM,GAAGe,CAAI,gBAAgB;AAC3D;AAAA,MACD;AAEA,YAAMN,IAAO,MAAMO,EAAK,KAAA;AACxB,MAAIP,KAAQ,QACXD,EAAOC,GAAMM,CAAI;AAAA,IACnB;AACA,WAAOE,EAAU;AAAA,EAClB;AAEA,SAAOb,EAAM,UAAU,IAAIH,GAAO,CAACiB,OAClCV,EAAOU,CAAI,GACJD,EAAU,QACjB;AACF,CAAC;"}
@@ -0,0 +1,19 @@
1
+ import { ANSI as o } from "@prozilla-os/shared";
2
+ import { Command as p, CommandsManager as u, EXIT_CODE as f, Shell as i } from "../main.js";
3
+ const $ = new p().setExecute(function(t, { stdout: a, stderr: m }) {
4
+ if (t.length === 0) {
5
+ const s = u.COMMANDS.map((e) => e.manual?.purpose ? `${e.name} - ${o.fg.green}${o.decoration.dim}${e.manual.purpose}${o.reset}` : e.name).sort().join(`
6
+ `);
7
+ return a.write(s), f.success;
8
+ }
9
+ const n = t[0].toLowerCase(), r = u.find(n);
10
+ if (!r)
11
+ return i.writeError(m, this.name, `${n}: Command not found`);
12
+ if (!r.manual?.purpose)
13
+ return i.writeError(m, this.name, `${n}: No manual found`);
14
+ a.write(r.manual.purpose);
15
+ });
16
+ export {
17
+ $ as help
18
+ };
19
+ //# sourceMappingURL=help-Drx0UDCY.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"help-Drx0UDCY.js","sources":["../../src/features/shell/commands/help.ts"],"sourcesContent":["import { ANSI } from \"@prozilla-os/shared\";\nimport { Shell } from \"../shell\";\nimport { Command } from \"../command\";\nimport { CommandsManager } from \"../commands\";\nimport { EXIT_CODE } from \"../../../constants\";\n\nexport const help = new Command()\n\t.setExecute(function(this: Command, args: string[], { stdout, stderr }) {\n\t\tif (args.length === 0) {\n\t\t\tconst output = CommandsManager.COMMANDS.map((command) => {\n\t\t\t\tif (command.manual?.purpose) {\n\t\t\t\t\treturn `${command.name} - ${ANSI.fg.green}${ANSI.decoration.dim}${command.manual.purpose}${ANSI.reset}`;\n\t\t\t\t} else {\n\t\t\t\t\treturn command.name;\n\t\t\t\t}\n\t\t\t}).sort().join(\"\\n\");\n\n\t\t\tstdout.write(output);\n\t\t\treturn EXIT_CODE.success;\n\t\t}\n\n\t\tconst commandName = args[0].toLowerCase();\n\t\tconst command = CommandsManager.find(commandName);\n\n\t\tif (!command) {\n\t\t\treturn Shell.writeError(stderr, this.name, `${commandName}: Command not found`);\n\t\t}\n\n\t\tif (!command.manual?.purpose) {\n\t\t\treturn Shell.writeError(stderr, this.name, `${commandName}: No manual found`);\n\t\t}\n\n\t\tstdout.write(command.manual.purpose);\n\t});"],"names":["help","Command","args","stdout","stderr","output","CommandsManager","command","ANSI","EXIT_CODE","commandName","Shell"],"mappings":";;AAMO,MAAMA,IAAO,IAAIC,EAAA,EACtB,WAAW,SAAwBC,GAAgB,EAAE,QAAAC,GAAQ,QAAAC,KAAU;AACvE,MAAIF,EAAK,WAAW,GAAG;AACtB,UAAMG,IAASC,EAAgB,SAAS,IAAI,CAACC,MACxCA,EAAQ,QAAQ,UACZ,GAAGA,EAAQ,IAAI,MAAMC,EAAK,GAAG,KAAK,GAAGA,EAAK,WAAW,GAAG,GAAGD,EAAQ,OAAO,OAAO,GAAGC,EAAK,KAAK,KAE9FD,EAAQ,IAEhB,EAAE,OAAO,KAAK;AAAA,CAAI;AAEnB,WAAAJ,EAAO,MAAME,CAAM,GACZI,EAAU;AAAA,EAClB;AAEA,QAAMC,IAAcR,EAAK,CAAC,EAAE,YAAA,GACtBK,IAAUD,EAAgB,KAAKI,CAAW;AAEhD,MAAI,CAACH;AACJ,WAAOI,EAAM,WAAWP,GAAQ,KAAK,MAAM,GAAGM,CAAW,qBAAqB;AAG/E,MAAI,CAACH,EAAQ,QAAQ;AACpB,WAAOI,EAAM,WAAWP,GAAQ,KAAK,MAAM,GAAGM,CAAW,mBAAmB;AAG7E,EAAAP,EAAO,MAAMI,EAAQ,OAAO,OAAO;AACpC,CAAC;"}
@@ -0,0 +1,17 @@
1
+ import { Command as u, EXIT_CODE as e } from "../main.js";
2
+ const m = new u().setManual({
3
+ purpose: "Display the command history list with line numbers",
4
+ usage: "history",
5
+ description: "Display the list of commands typed since the shell session started."
6
+ }).setExecute(function(a, { stdout: n, shell: i }) {
7
+ const s = i.state.history.filter(({ isCommand: t }) => t);
8
+ if (s.length === 0)
9
+ return e.success;
10
+ const r = s.map((t, o) => `${(o + 1).toString().padStart(5, " ")} ${t.value}`).join(`
11
+ `);
12
+ return n.write(r), e.success;
13
+ });
14
+ export {
15
+ m as history
16
+ };
17
+ //# sourceMappingURL=history-BEJhnsrb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"history-BEJhnsrb.js","sources":["../../src/features/shell/commands/history.ts"],"sourcesContent":["import { Command } from \"../command\";\nimport { EXIT_CODE } from \"../../../constants\";\n\nexport const history = new Command()\n\t.setManual({\n\t\tpurpose: \"Display the command history list with line numbers\",\n\t\tusage: \"history\",\n\t\tdescription: \"Display the list of commands typed since the shell session started.\",\n\t})\n\t.setExecute(function(this: Command, _args, { stdout, shell }) {\n\t\tconst inputHistory = shell.state.history.filter(({ isCommand }) => isCommand);\n\n\t\tif (inputHistory.length === 0) \n\t\t\treturn EXIT_CODE.success;\n\n\t\tconst output = inputHistory\n\t\t\t.map((entry, index) => {\n\t\t\t\tconst lineNumber = (index + 1).toString().padStart(5, \" \");\n\t\t\t\treturn `${lineNumber} ${entry.value}`;\n\t\t\t})\n\t\t\t.join(\"\\n\");\n\n\t\tstdout.write(output);\n\n\t\treturn EXIT_CODE.success;\n\t});"],"names":["history","Command","_args","stdout","shell","inputHistory","isCommand","EXIT_CODE","output","entry","index"],"mappings":";AAGO,MAAMA,IAAU,IAAIC,EAAA,EACzB,UAAU;AAAA,EACV,SAAS;AAAA,EACT,OAAO;AAAA,EACP,aAAa;AACd,CAAC,EACA,WAAW,SAAwBC,GAAO,EAAE,QAAAC,GAAQ,OAAAC,KAAS;AAC7D,QAAMC,IAAeD,EAAM,MAAM,QAAQ,OAAO,CAAC,EAAE,WAAAE,EAAA,MAAgBA,CAAS;AAE5E,MAAID,EAAa,WAAW;AAC3B,WAAOE,EAAU;AAElB,QAAMC,IAASH,EACb,IAAI,CAACI,GAAOC,MAEL,IADaA,IAAQ,GAAG,WAAW,SAAS,GAAG,GAAG,CACrC,KAAKD,EAAM,KAAK,EACpC,EACA,KAAK;AAAA,CAAI;AAEX,SAAAN,EAAO,MAAMK,CAAM,GAEZD,EAAU;AAClB,CAAC;"}
@@ -0,0 +1,10 @@
1
+ import { Command as o } from "../main.js";
2
+ const a = new o().setManual({
3
+ purpose: "Display the hostname"
4
+ }).setExecute(function(n, { hostname: e, stdout: t }) {
5
+ t.write(e);
6
+ });
7
+ export {
8
+ a as hostname
9
+ };
10
+ //# sourceMappingURL=hostname-D8sxyWIy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hostname-D8sxyWIy.js","sources":["../../src/features/shell/commands/hostname.ts"],"sourcesContent":["import { Command } from \"../command\";\n\nexport const hostname = new Command()\n\t.setManual({\n\t\tpurpose: \"Display the hostname\",\n\t})\n\t.setExecute(function(_args, { hostname, stdout }) {\n\t\tstdout.write(hostname);\n\t});"],"names":["hostname","Command","_args","stdout"],"mappings":";AAEO,MAAMA,IAAW,IAAIC,EAAA,EAC1B,UAAU;AAAA,EACV,SAAS;AACV,CAAC,EACA,WAAW,SAASC,GAAO,EAAE,UAAAF,GAAU,QAAAG,KAAU;AACjD,EAAAA,EAAO,MAAMH,CAAQ;AACtB,CAAC;"}
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=htop-l0sNRNKZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"htop-l0sNRNKZ.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}