@prozilla-os/core 1.3.14 → 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,67 @@
1
+ import { parseOptionalFloat as f, ANSI as e } from "@prozilla-os/shared";
2
+ import { Command as O, Stream as x, EXIT_CODE as S } from "../main.js";
3
+ const p = [
4
+ e.fg.red,
5
+ e.fg.yellow,
6
+ e.fg.green,
7
+ e.fg.cyan,
8
+ e.fg.blue,
9
+ e.fg.magenta
10
+ ], F = new O().setManual({
11
+ purpose: "Display text with a rainbow effect",
12
+ usage: "lolcat [ -p spread ] [ -F freq ] [ -S seed ]",
13
+ options: {
14
+ "-p spread": "Rainbow spread (default: 3.0)",
15
+ "-F freq": "Rainbow frequency (default: 0.1)",
16
+ "-S seed": "Rainbow seed (default: 0)"
17
+ }
18
+ }).addOption({
19
+ short: "p",
20
+ long: "spread",
21
+ isInput: !0
22
+ }).addOption({
23
+ short: "F",
24
+ long: "freq",
25
+ isInput: !0
26
+ }).addOption({
27
+ short: "S",
28
+ long: "seed",
29
+ isInput: !0
30
+ }).setExecute(function(y, { timestamp: g, stdout: h, stdin: d, inputs: l }) {
31
+ const m = f(l.p, 3), w = f(l.F, 0.1), b = f(l.S);
32
+ let i = 0;
33
+ const I = (o) => {
34
+ let s = "", r = 0, a = 0;
35
+ const q = g / 1e3;
36
+ for (; r < o.length; ) {
37
+ const t = o[r];
38
+ if (t === "\x1B") {
39
+ const c = o.substring(r).match(/^\u001b\[[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/);
40
+ if (c) {
41
+ const n = c[0];
42
+ s += n, (n === e.screen.home || n === e.screen.clear) && (i = 0, a = 0), r += n.length;
43
+ continue;
44
+ }
45
+ }
46
+ if (t === `
47
+ `)
48
+ s += `
49
+ `, i++, a = 0;
50
+ else if (t === "\r" || t === " " || t === " ")
51
+ s += t, a++;
52
+ else {
53
+ const u = w * (b + i + a / m + q), c = Math.floor(Math.abs(u) * p.length), n = p[c % p.length];
54
+ s += n + t + e.reset, a++;
55
+ }
56
+ r++;
57
+ }
58
+ h.write(s);
59
+ };
60
+ return d.on(x.DATA_EVENT, (o) => {
61
+ I(o);
62
+ }), d.wait(S.success);
63
+ });
64
+ export {
65
+ F as lolcat
66
+ };
67
+ //# sourceMappingURL=lolcat-Dyjbg15t.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lolcat-Dyjbg15t.js","sources":["../../src/features/shell/commands/lolcat.ts"],"sourcesContent":["import { ANSI, parseOptionalFloat } from \"@prozilla-os/shared\";\nimport { Command } from \"../command\";\nimport { Stream } from \"../stream\";\nimport { EXIT_CODE } from \"../../../constants\";\n\nconst RAINBOW = [\n\tANSI.fg.red,\n\tANSI.fg.yellow,\n\tANSI.fg.green,\n\tANSI.fg.cyan,\n\tANSI.fg.blue,\n\tANSI.fg.magenta,\n];\n\nexport const lolcat = new Command()\n\t.setManual({\n\t\tpurpose: \"Display text with a rainbow effect\",\n\t\tusage: \"lolcat [ -p spread ] [ -F freq ] [ -S seed ]\",\n\t\toptions: {\n\t\t\t\"-p spread\": \"Rainbow spread (default: 3.0)\",\n\t\t\t\"-F freq\": \"Rainbow frequency (default: 0.1)\",\n\t\t\t\"-S seed\": \"Rainbow seed (default: 0)\",\n\t\t},\n\t})\n\t.addOption({\n\t\tshort: \"p\",\n\t\tlong: \"spread\",\n\t\tisInput: true,\n\t})\n\t.addOption({\n\t\tshort: \"F\",\n\t\tlong: \"freq\",\n\t\tisInput: true,\n\t})\n\t.addOption({\n\t\tshort: \"S\",\n\t\tlong: \"seed\",\n\t\tisInput: true,\n\t})\n\t.setExecute(function(this: Command, _args, { timestamp, stdout, stdin, inputs }) {\n\t\tconst spread = parseOptionalFloat(inputs.p, 3.0);\n\t\tconst freq = parseOptionalFloat(inputs.F, 0.1);\n\t\tconst seed = parseOptionalFloat(inputs.S);\n\n\t\tlet lineIndex = 0;\n\n\t\tconst processText = (text: string) => {\n\t\t\tlet output = \"\";\n\t\t\tlet i = 0;\n\t\t\tlet colIndex = 0;\n\t\t\tconst offset = timestamp / 1000;\n\n\t\t\twhile (i < text.length) {\n\t\t\t\tconst char = text[i];\n\n\t\t\t\tif (char === \"\\x1b\") {\n\t\t\t\t\tconst remaining = text.substring(i);\n\t\t\t\t\t// eslint-disable-next-line no-control-regex\n\t\t\t\t\tconst match = remaining.match(/^\\u001b\\[[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/);\n\t\t\t\t\t\n\t\t\t\t\tif (match) {\n\t\t\t\t\t\tconst seq = match[0];\n\t\t\t\t\t\toutput += seq;\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (seq === ANSI.screen.home || seq === ANSI.screen.clear) {\n\t\t\t\t\t\t\tlineIndex = 0;\n\t\t\t\t\t\t\tcolIndex = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\ti += seq.length;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (char === \"\\n\") {\n\t\t\t\t\toutput += \"\\n\";\n\t\t\t\t\tlineIndex++;\n\t\t\t\t\tcolIndex = 0;\n\t\t\t\t} else if (char === \"\\r\" || char === \"\\t\" || char === \" \") {\n\t\t\t\t\toutput += char;\n\t\t\t\t\tcolIndex++;\n\t\t\t\t} else {\n\t\t\t\t\tconst iVal = freq * (seed + lineIndex + colIndex / spread + offset);\n\t\t\t\t\tconst rainbowIndex = Math.floor(Math.abs(iVal) * RAINBOW.length);\n\t\t\t\t\tconst color = RAINBOW[rainbowIndex % RAINBOW.length];\n\n\t\t\t\t\toutput += color + char + ANSI.reset;\n\t\t\t\t\tcolIndex++;\n\t\t\t\t}\n\t\t\t\ti++;\n\t\t\t}\n\n\t\t\tstdout.write(output);\n\t\t};\n\n\t\tstdin.on(Stream.DATA_EVENT, (data) => {\n\t\t\tprocessText(data);\n\t\t});\n\n\t\treturn stdin.wait(EXIT_CODE.success);\n\t});"],"names":["RAINBOW","ANSI","lolcat","Command","_args","timestamp","stdout","stdin","inputs","spread","parseOptionalFloat","freq","seed","lineIndex","processText","text","output","i","colIndex","offset","char","match","seq","iVal","rainbowIndex","color","Stream","data","EXIT_CODE"],"mappings":";;AAKA,MAAMA,IAAU;AAAA,EACfC,EAAK,GAAG;AAAA,EACRA,EAAK,GAAG;AAAA,EACRA,EAAK,GAAG;AAAA,EACRA,EAAK,GAAG;AAAA,EACRA,EAAK,GAAG;AAAA,EACRA,EAAK,GAAG;AACT,GAEaC,IAAS,IAAIC,EAAA,EACxB,UAAU;AAAA,EACV,SAAS;AAAA,EACT,OAAO;AAAA,EACP,SAAS;AAAA,IACR,aAAa;AAAA,IACb,WAAW;AAAA,IACX,WAAW;AAAA,EAAA;AAEb,CAAC,EACA,UAAU;AAAA,EACV,OAAO;AAAA,EACP,MAAM;AAAA,EACN,SAAS;AACV,CAAC,EACA,UAAU;AAAA,EACV,OAAO;AAAA,EACP,MAAM;AAAA,EACN,SAAS;AACV,CAAC,EACA,UAAU;AAAA,EACV,OAAO;AAAA,EACP,MAAM;AAAA,E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I;AAAA,EACjB,CAAC,GAEMpB,EAAM,KAAKqB,EAAU,OAAO;AACpC,CAAC;"}
@@ -0,0 +1,17 @@
1
+ import { Command as f, Shell as d } from "../main.js";
2
+ import { ANSI as s } from "@prozilla-os/shared";
3
+ const p = new f().setManual({
4
+ purpose: "List directory contents",
5
+ usage: "ls [options] [files]",
6
+ description: "List information about directories or files (the current directory by default)."
7
+ }).setExecute(function(t, { workingDirectory: i, stdout: n, stderr: c }) {
8
+ let e = i;
9
+ if (t.length && (e = i.navigateToFolder(t[0])), !e)
10
+ return d.writeError(c, this.name, `Cannot access '${t[0]}': No such file or directory`);
11
+ const l = e.subFolders.map((o) => `${s.fg.blue}${o.id}${s.reset}`), a = e.files.map((o) => o.id), r = l.concat(a);
12
+ r.length > 0 && n.write(r.sort().join(" "));
13
+ });
14
+ export {
15
+ p as ls
16
+ };
17
+ //# sourceMappingURL=ls-DnmR50y0.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ls-DnmR50y0.js","sources":["../../src/features/shell/commands/ls.ts"],"sourcesContent":["import { VirtualFolder } from \"../../virtual-drive\";\nimport { Shell } from \"../shell\";\nimport { Command } from \"../command\";\nimport { ANSI } from \"@prozilla-os/shared\";\n\nexport const ls = new Command()\n\t.setManual({\n\t\tpurpose: \"List directory contents\",\n\t\tusage: \"ls [options] [files]\",\n\t\tdescription: \"List information about directories or files (the current directory by default).\",\n\t})\n\t.setExecute(function(this: Command, args, { workingDirectory, stdout, stderr }) {\n\t\tlet directory: VirtualFolder | null = workingDirectory;\n\t\n\t\tif (args.length) {\n\t\t\tdirectory = workingDirectory.navigateToFolder(args[0]);\n\t\t}\n\t\n\t\tif (!directory)\n\t\t\treturn Shell.writeError(stderr, this.name, `Cannot access '${args[0]}': No such file or directory`);\n\t\n\t\tconst folderNames = directory.subFolders.map((folder) => `${ANSI.fg.blue}${folder.id}${ANSI.reset}`);\n\t\tconst fileNames = directory.files.map((file) => file.id);\n\t\n\t\tconst contents = folderNames.concat(fileNames);\n\t\n\t\tif (contents.length > 0) {\n\t\t\tstdout.write(contents.sort().join(\" \"));\n\t\t}\n\t});"],"names":["ls","Command","args","workingDirectory","stdout","stderr","directory","Shell","folderNames","folder","ANSI","fileNames","file","contents"],"mappings":";;AAKO,MAAMA,IAAK,IAAIC,EAAA,EACpB,UAAU;AAAA,EACV,SAAS;AAAA,EACT,OAAO;AAAA,EACP,aAAa;AACd,CAAC,EACA,WAAW,SAAwBC,GAAM,EAAE,kBAAAC,GAAkB,QAAAC,GAAQ,QAAAC,KAAU;AAC/E,MAAIC,IAAkCH;AAMtC,MAJID,EAAK,WACRI,IAAYH,EAAiB,iBAAiBD,EAAK,CAAC,CAAC,IAGlD,CAACI;AACJ,WAAOC,EAAM,WAAWF,GAAQ,KAAK,MAAM,kBAAkBH,EAAK,CAAC,CAAC,8BAA8B;AAEnG,QAAMM,IAAcF,EAAU,WAAW,IAAI,CAACG,MAAW,GAAGC,EAAK,GAAG,IAAI,GAAGD,EAAO,EAAE,GAAGC,EAAK,KAAK,EAAE,GAC7FC,IAAYL,EAAU,MAAM,IAAI,CAACM,MAASA,EAAK,EAAE,GAEjDC,IAAWL,EAAY,OAAOG,CAAS;AAE7C,EAAIE,EAAS,SAAS,KACrBT,EAAO,MAAMS,EAAS,KAAA,EAAO,KAAK,IAAI,CAAC;AAEzC,CAAC;"}
@@ -0,0 +1,60 @@
1
+ import { ANSI as h, Ansi as r } from "@prozilla-os/shared";
2
+ import { Command as N, CommandsManager as g, Shell as w } from "../main.js";
3
+ const O = 5, C = new N().setRequireArgs(!0).setManual({
4
+ purpose: "Show system reference manuals",
5
+ usage: `man [options] page
6
+ man -k [options] regexp`,
7
+ description: `Each page arguments given to man is normally the name of a command.
8
+ The manual page associated with this command is then found and displayed.`,
9
+ options: {
10
+ "-k": "Search for manual page using regexp"
11
+ }
12
+ }).addOption({
13
+ short: "k",
14
+ long: "apropos"
15
+ }).setExecute(function(u, { options: S, stdout: l, stderr: c }) {
16
+ if (S.includes("k")) {
17
+ const a = g.search(u[0].toLowerCase()).map((n) => n.manual?.purpose ? `${n.name} - ${n.manual.purpose}` : n.name).sort().join(`
18
+ `);
19
+ l.write(a + `
20
+ `);
21
+ return;
22
+ }
23
+ const s = u[0].toLowerCase(), p = g.find(s);
24
+ if (!p)
25
+ return w.writeError(c, this.name, `${s}: Command not found`);
26
+ const o = p.manual;
27
+ if (!o)
28
+ return w.writeError(c, this.name, `${s}: No manual found`);
29
+ const i = (e) => e.split(`
30
+ `).map((n) => " ".repeat(O) + n).join(`
31
+ `), t = [["NAME"]];
32
+ o.purpose ? t[0].push(i(`${s} - ${h.decoration.dim}${r.yellow(o.purpose)}`)) : t[0].push(i(s)), o.usage && t.push([
33
+ "SYNOPSIS",
34
+ i(o.usage)
35
+ ]), o.description && t.push([
36
+ "DESCRIPTION",
37
+ i(o.description)
38
+ ]), o.options && t.push([
39
+ "OPTIONS",
40
+ i(Object.entries(o.options).map(([e, a]) => {
41
+ let n = e.split(" ");
42
+ const d = n[0].slice(1);
43
+ n = n.slice(1);
44
+ let m = "-" + d;
45
+ const f = p.options.find((y) => y.short == d);
46
+ return f !== void 0 && (m += ", --" + f.long), n.length && (m += " " + r.dim(n.join(" "))), `${m} ${h.decoration.dim}${r.yellow(String(a))}`;
47
+ }).join(`
48
+ `))
49
+ ]);
50
+ const $ = t.map((e) => (e[0] = r.yellow(e[0]), e.join(`
51
+ `))).join(`
52
+
53
+ `);
54
+ l.write($ + `
55
+ `);
56
+ });
57
+ export {
58
+ C as man
59
+ };
60
+ //# sourceMappingURL=man-7W6T7lda.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"man-7W6T7lda.js","sources":["../../src/features/shell/commands/man.ts"],"sourcesContent":["import { Ansi, ANSI } from \"@prozilla-os/shared\";\nimport { Shell } from \"../shell\";\nimport { Command } from \"../command\";\nimport { CommandsManager } from \"../commands\";\n\nconst MARGIN = 5;\n\nexport const man = new Command()\n\t.setRequireArgs(true)\n\t.setManual({\n\t\tpurpose: \"Show system reference manuals\",\n\t\tusage: \"man [options] page\\n\"\n\t\t\t+ \"man -k [options] regexp\",\n\t\tdescription: \"Each page arguments given to man is normally the name of a command.\\n\"\n\t\t\t+ \"The manual page associated with this command is then found and displayed.\",\n\t\toptions: {\n\t\t\t\"-k\": \"Search for manual page using regexp\",\n\t\t},\n\t})\n\t.addOption({\n\t\tshort: \"k\",\n\t\tlong: \"apropos\",\n\t})\n\t.setExecute(function(this: Command, args, { options, stdout, stderr }) {\n\t\t// Search function\n\t\tif (options.includes(\"k\")) {\n\t\t\tconst commands = CommandsManager.search(args[0].toLowerCase());\n\t\t\tconst output = commands.map((command) => {\n\t\t\t\tif (command.manual?.purpose) {\n\t\t\t\t\treturn `${command.name} - ${command.manual.purpose}`;\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\");\n\t\t\treturn;\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\n\t\tconst manual = command.manual;\n\n\t\tif (!manual)\n\t\t\treturn Shell.writeError(stderr, this.name, `${commandName}: No manual found`);\n\n\t\tconst formatText = (text: string) => {\n\t\t\tconst lines = text.split(\"\\n\").map((line) => \" \".repeat(MARGIN) + line);\n\t\t\treturn lines.join(\"\\n\");\n\t\t};\n\n\t\tconst sections = [[\"NAME\"]];\n\n\t\tif (manual.purpose) {\n\t\t\tsections[0].push(formatText(`${commandName} - ${ANSI.decoration.dim}${Ansi.yellow(manual.purpose)}`));\n\t\t} else {\n\t\t\tsections[0].push(formatText(commandName));\n\t\t}\n\n\t\tif (manual.usage) {\n\t\t\tsections.push([\n\t\t\t\t\"SYNOPSIS\",\n\t\t\t\tformatText(manual.usage),\n\t\t\t]);\n\t\t}\n\t\t\n\t\tif (manual.description) {\n\t\t\tsections.push([\n\t\t\t\t\"DESCRIPTION\",\n\t\t\t\tformatText(manual.description),\n\t\t\t]);\n\t\t}\n\n\t\tif (manual.options) {\n\t\t\tsections.push([\n\t\t\t\t\"OPTIONS\",\n\t\t\t\tformatText(Object.entries(manual.options).map(([key, value]) => {\n\t\t\t\t\tlet rawOptionSyntax = key.split(\" \");\n\t\t\t\t\tconst shortOption = rawOptionSyntax[0].slice(1);\n\t\t\t\t\trawOptionSyntax = rawOptionSyntax.slice(1);\n\n\t\t\t\t\tlet optionSyntax = \"-\" + shortOption;\n\t\t\t\t\tconst option = command.options.find((option) => option.short == shortOption);\n\t\t\t\t\tif (option !== undefined) {\n\t\t\t\t\t\toptionSyntax += \", --\" + option.long;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (rawOptionSyntax.length) {\n\t\t\t\t\t\toptionSyntax += \" \" + Ansi.dim(rawOptionSyntax.join(\" \"));\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\treturn `${optionSyntax} ${ANSI.decoration.dim}${Ansi.yellow(String(value))}`;\n\t\t\t\t}).join(\"\\n\")),\n\t\t\t]);\n\t\t}\n\n\t\tconst output = sections.map((section) => {\n\t\t\tsection[0] = Ansi.yellow(section[0]);\n\t\t\treturn section.join(\"\\n\");\n\t\t}).join(\"\\n\\n\");\n\n\t\tstdout.write(output + \"\\n\");\n\t});"],"names":["MARGIN","man","Command","args","options","stdout","stderr","output","CommandsManager","command","commandName","Shell","manual","formatText","text","line","sections","ANSI","Ansi","key","value","rawOptionSyntax","shortOption","optionSyntax","option","section"],"mappings":";;AAKA,MAAMA,IAAS,GAEFC,IAAM,IAAIC,EAAA,EACrB,eAAe,EAAI,EACnB,UAAU;AAAA,EACV,SAAS;AAAA,EACT,OAAO;AAAA;AAAA,EAEP,aAAa;AAAA;AAAA,EAEb,SAAS;AAAA,IACR,MAAM;AAAA,EAAA;AAER,CAAC,EACA,UAAU;AAAA,EACV,OAAO;AAAA,EACP,MAAM;AACP,CAAC,EACA,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I,EAAS,KAAK;AAAA,IACb;AAAA,IACAH,EAAW,OAAO,QAAQD,EAAO,OAAO,EAAE,IAAI,CAAC,CAACO,GAAKC,CAAK,MAAM;AAC/D,UAAIC,IAAkBF,EAAI,MAAM,GAAG;AACnC,YAAMG,IAAcD,EAAgB,CAAC,EAAE,MAAM,CAAC;AAC9C,MAAAA,IAAkBA,EAAgB,MAAM,CAAC;AAEzC,UAAIE,IAAe,MAAMD;AACzB,YAAME,IAASf,EAAQ,QAAQ,KAAK,CAACe,MAAWA,EAAO,SAASF,CAAW;AAC3E,aAAIE,MAAW,WACdD,KAAgB,SAASC,EAAO,OAG7BH,EAAgB,WACnBE,KAAgB,MAAML,EAAK,IAAIG,EAAgB,KAAK,GAAG,CAAC,IAGlD,GAAGE,CAAY,IAAIN,EAAK,WAAW,GAAG,GAAGC,EAAK,OAAO,OAAOE,CAAK,CAAC,CAAC;AAAA,IAC3E,CAAC,EAAE,KAAK;AAAA,CAAI,CAAC;AAAA,EAAA,CACb;AAGF,QAAMb,IAASS,EAAS,IAAI,CAACS,OAC5BA,EAAQ,CAAC,IAAIP,EAAK,OAAOO,EAAQ,CAAC,CAAC,GAC5BA,EAAQ,KAAK;AAAA,CAAI,EACxB,EAAE,KAAK;AAAA;AAAA,CAAM;AAEd,EAAApB,EAAO,MAAME,IAAS;AAAA,CAAI;AAC3B,CAAC;"}
@@ -0,0 +1,11 @@
1
+ import { Command as n } from "../main.js";
2
+ const u = new n().setManual({
3
+ purpose: "Create a directory"
4
+ }).setRequireArgs(!0).setExecute(function(t, { workingDirectory: e }) {
5
+ const r = t[0];
6
+ e.findSubFolder(r) || e.createFolder(r);
7
+ });
8
+ export {
9
+ u as mkdir
10
+ };
11
+ //# sourceMappingURL=mkdir-BdEywO2H.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mkdir-BdEywO2H.js","sources":["../../src/features/shell/commands/mkdir.ts"],"sourcesContent":["import { Command } from \"../command\";\n\nexport const mkdir = new Command()\n\t.setManual({\n\t\tpurpose: \"Create a directory\",\n\t})\n\t.setRequireArgs(true)\n\t.setExecute(function(args, { workingDirectory }) {\n\t\tconst name = args[0];\n\t\n\t\tif (workingDirectory.findSubFolder(name))\n\t\t\treturn;\n\t\n\t\tworkingDirectory.createFolder(name);\n\t\treturn;\n\t});"],"names":["mkdir","Command","args","workingDirectory","name"],"mappings":";AAEO,MAAMA,IAAQ,IAAIC,EAAA,EACvB,UAAU;AAAA,EACV,SAAS;AACV,CAAC,EACA,eAAe,EAAI,EACnB,WAAW,SAASC,GAAM,EAAE,kBAAAC,KAAoB;AAChD,QAAMC,IAAOF,EAAK,CAAC;AAEnB,EAAIC,EAAiB,cAAcC,CAAI,KAGvCD,EAAiB,aAAaC,CAAI;AAEnC,CAAC;"}
@@ -0,0 +1,40 @@
1
+ import { ANSI as n } from "@prozilla-os/shared";
2
+ import { Command as C, Settings as A, ANSI_LOGO_COLOR as I, ANSI_ASCII_LOGO as O } from "../main.js";
3
+ import { Theme as s } from "@prozilla-os/skins";
4
+ const _ = new C().setManual({
5
+ purpose: "Fetch system information"
6
+ }).setExecute(async function(x, { username: m, hostname: l, app: w, systemManager: g, settingsManager: S, stdout: d }) {
7
+ const f = O.split(`
8
+ `), c = m.length + l.length + 1, a = (await S.getSettings(A.THEME).get("theme")).value;
9
+ let h = s[s.Dark];
10
+ a != null && parseInt(a) && (h = s[parseInt(a)]);
11
+ const r = navigator.userAgent;
12
+ let o;
13
+ r.match(/Firefox\//) ? o = "Mozilla Firefox" : r.match(/Edg\//) ? o = "Microsoft Edge" : r.match(/Chrome\//) ? o = "Google Chrome" : r.match(/Safari\//) ? o = "Apple Safari" : o = "Unknown";
14
+ const e = (t, i) => n.fg.cyan + t.toUpperCase() + n.reset + ": " + i, p = [
15
+ `${n.fg.cyan + m + n.reset}@${n.fg.cyan + l + n.reset}`,
16
+ "-".repeat(c),
17
+ e("os", g.systemName),
18
+ e("uptime", g.getUptime(2)),
19
+ e("resolution", window.innerWidth + "x" + window.innerHeight),
20
+ e("theme", h),
21
+ e("icons", "Font Awesome"),
22
+ e("terminal", w?.name ?? "Unknown"),
23
+ e("browser", o),
24
+ e("platform", navigator.platform),
25
+ e("language", navigator.language),
26
+ "",
27
+ Object.values(n.fg).map((t) => t + "███").join("") + n.reset
28
+ ], u = [];
29
+ for (let t = 1; t < f.length; t++) {
30
+ let i = `${I + f[t] + n.reset} `;
31
+ t <= p.length ? i += p[t - 1] : i += " ".repeat(c), u.push(i);
32
+ }
33
+ d.write(u.join(`
34
+ `) + `
35
+ `);
36
+ });
37
+ export {
38
+ _ as neofetch
39
+ };
40
+ //# sourceMappingURL=neofetch--vHMIS9v.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"neofetch--vHMIS9v.js","sources":["../../src/features/shell/commands/neofetch.ts"],"sourcesContent":["import { ANSI } from \"@prozilla-os/shared\";\nimport { ANSI_ASCII_LOGO, ANSI_LOGO_COLOR } from \"../../../constants/shell.const\";\nimport { Command } from \"../command\";\nimport { Theme } from \"@prozilla-os/skins\";\nimport { Settings } from \"../../settings/settings\";\n\nexport const neofetch = new Command()\n\t.setManual({\n\t\tpurpose: \"Fetch system information\",\n\t})\n\t.setExecute(async function(_arguments, { username, hostname, app, systemManager, settingsManager, stdout }) {\n\t\tconst leftColumn = ANSI_ASCII_LOGO.split(\"\\n\");\n\t\tconst rightColumnWidth = username.length + hostname.length + 1;\n\n\t\tconst themeSetting = await settingsManager.getSettings(Settings.THEME).get(\"theme\");\n\t\tconst themeIndex = themeSetting.value;\n\t\t\n\t\tlet theme = Theme[Theme.Dark];\n\t\tif (themeIndex != null && parseInt(themeIndex)) {\n\t\t\ttheme = Theme[parseInt(themeIndex)];\n\t\t}\n\n\t\tconst userAgent = navigator.userAgent;\n\n\t\t// Check for the browser name using regular expressions\n\t\tlet browserName;\n\t\tif (userAgent.match(/Firefox\\//)) {\n\t\t\tbrowserName = \"Mozilla Firefox\";\n\t\t} else if (userAgent.match(/Edg\\//)) {\n\t\t\tbrowserName = \"Microsoft Edge\";\n\t\t} else if (userAgent.match(/Chrome\\//)) {\n\t\t\tbrowserName = \"Google Chrome\";\n\t\t} else if (userAgent.match(/Safari\\//)) {\n\t\t\tbrowserName = \"Apple Safari\";\n\t\t} else {\n\t\t\tbrowserName = \"Unknown\";\n\t\t}\n\n\t\tconst formatLine = (label: string, text: string) => ANSI.fg.cyan + label.toUpperCase() + ANSI.reset + \": \" + text;\n\n\t\tconst rightColumn = [\n\t\t\t`${ANSI.fg.cyan + username + ANSI.reset}@${ANSI.fg.cyan + hostname + ANSI.reset}`,\n\t\t\t\"-\".repeat(rightColumnWidth),\n\t\t\tformatLine(\"os\", systemManager.systemName),\n\t\t\tformatLine(\"uptime\", systemManager.getUptime(2)),\n\t\t\tformatLine(\"resolution\", window.innerWidth + \"x\" + window.innerHeight),\n\t\t\tformatLine(\"theme\", theme),\n\t\t\tformatLine(\"icons\", \"Font Awesome\"),\n\t\t\tformatLine(\"terminal\", app?.name ?? \"Unknown\"),\n\t\t\tformatLine(\"browser\", browserName),\n\t\t\tformatLine(\"platform\", navigator.platform),\n\t\t\tformatLine(\"language\", navigator.language),\n\t\t\t\"\",\n\t\t\tObject.values(ANSI.fg).map((colorCode) => colorCode + \"███\").join(\"\") + ANSI.reset,\n\t\t];\n\n\t\tconst combined = [];\n\t\tfor (let i = 1; i < leftColumn.length; i++) {\n\t\t\tlet line = `${ANSI_LOGO_COLOR + leftColumn[i] + ANSI.reset} `;\n\n\t\t\tif (i <= rightColumn.length) {\n\t\t\t\tline += rightColumn[i - 1];\n\t\t\t} else {\n\t\t\t\t// This fixes a weird display bug on Safari mobile\n\t\t\t\tline += \" \".repeat(rightColumnWidth);\n\t\t\t}\n\n\t\t\tcombined.push(line);\n\t\t}\n\n\t\tstdout.write(combined.join(\"\\n\") + \"\\n\");\n\t});"],"names":["neofetch","Command","_arguments","username","hostname","app","systemManager","settingsManager","stdout","leftColumn","ANSI_ASCII_LOGO","rightColumnWidth","themeIndex","Settings","theme","Theme","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,IAClCA,EAAW,YAAYb,GAAK,QAAQ,SAAS;AAAA,IAC7Ca,EAAW,WAAWD,CAAW;AAAA,IACjCC,EAAW,YAAY,UAAU,QAAQ;AAAA,IACzCA,EAAW,YAAY,UAAU,QAAQ;AAAA,IACzC;AAAA,IACA,OAAO,OAAOG,EAAK,EAAE,EAAE,IAAI,CAACE,MAAcA,IAAY,KAAK,EAAE,KAAK,EAAE,IAAIF,EAAK;AAAA,EAAA,GAGxEG,IAAW,CAAA;AACjB,WAASC,IAAI,GAAGA,IAAIhB,EAAW,QAAQgB,KAAK;AAC3C,QAAIC,IAAO,GAAGC,IAAkBlB,EAAWgB,CAAC,IAAIJ,EAAK,KAAK;AAE1D,IAAII,KAAKH,EAAY,SACpBI,KAAQJ,EAAYG,IAAI,CAAC,IAGzBC,KAAQ,IAAI,OAAOf,CAAgB,GAGpCa,EAAS,KAAKE,CAAI;AAAA,EACnB;AAEA,EAAAlB,EAAO,MAAMgB,EAAS,KAAK;AAAA,CAAI,IAAI;AAAA,CAAI;AACxC,CAAC;"}
@@ -0,0 +1,24 @@
1
+ import { Command as a } from "../main.js";
2
+ const p = new a().setManual({
3
+ purpose: "Print all or part of environment",
4
+ usage: "printenv [VARIABLE]...",
5
+ description: "Print the values of the specified environment VARIABLE(s). If no VARIABLE is specified, print name and value pairs for them all."
6
+ }).setExecute(function(t, { stdout: r, env: o }) {
7
+ const i = o.exportedVariables;
8
+ if (t.length > 0) {
9
+ t.forEach((n) => {
10
+ const e = i[n];
11
+ e !== void 0 && r.write(`${e}
12
+ `);
13
+ });
14
+ return;
15
+ }
16
+ Object.entries(i).forEach(([n, e]) => {
17
+ r.write(`${n}=${e}
18
+ `);
19
+ });
20
+ });
21
+ export {
22
+ p as printenv
23
+ };
24
+ //# sourceMappingURL=printenv-6OpJKd7g.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"printenv-6OpJKd7g.js","sources":["../../src/features/shell/commands/printenv.ts"],"sourcesContent":["import { Command } from \"../command\";\n\nexport const printenv = new Command()\n\t.setManual({\n\t\tpurpose: \"Print all or part of environment\",\n\t\tusage: \"printenv [VARIABLE]...\",\n\t\tdescription: \"Print the values of the specified environment VARIABLE(s). If no VARIABLE is specified, print name and value pairs for them all.\",\n\t})\n\t.setExecute(function(this: Command, args, { stdout, env }) {\n\t\tconst exportedVars = env.exportedVariables;\n\n\t\tif (args.length > 0) {\n\t\t\targs.forEach((arg) => {\n\t\t\t\tconst value = exportedVars[arg];\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n\t\t\t\tif (value !== undefined) stdout.write(`${value}\\n`);\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tObject.entries(exportedVars).forEach(([key, value]) => {\n\t\t\tstdout.write(`${key}=${value}\\n`);\n\t\t});\n\t});"],"names":["printenv","Command","args","stdout","env","exportedVars","arg","value","key"],"mappings":";AAEO,MAAMA,IAAW,IAAIC,EAAA,EAC1B,UAAU;AAAA,EACV,SAAS;AAAA,EACT,OAAO;AAAA,EACP,aAAa;AACd,CAAC,EACA,WAAW,SAAwBC,GAAM,EAAE,QAAAC,GAAQ,KAAAC,KAAO;AAC1D,QAAMC,IAAeD,EAAI;AAEzB,MAAIF,EAAK,SAAS,GAAG;AACpB,IAAAA,EAAK,QAAQ,CAACI,MAAQ;AACrB,YAAMC,IAAQF,EAAaC,CAAG;AAE9B,MAAIC,MAAU,UAAWJ,EAAO,MAAM,GAAGI,CAAK;AAAA,CAAI;AAAA,IACnD,CAAC;AACD;AAAA,EACD;AAEA,SAAO,QAAQF,CAAY,EAAE,QAAQ,CAAC,CAACG,GAAKD,CAAK,MAAM;AACtD,IAAAJ,EAAO,MAAM,GAAGK,CAAG,IAAID,CAAK;AAAA,CAAI;AAAA,EACjC,CAAC;AACF,CAAC;"}
@@ -0,0 +1,11 @@
1
+ import { Command as r } from "../main.js";
2
+ const p = new r().setManual({
3
+ purpose: "Display path of the current directory"
4
+ }).setExecute(function(a, { workingDirectory: t, stdout: o }) {
5
+ let e = t.absolutePath;
6
+ t.root && (e = "/"), o.write(e);
7
+ });
8
+ export {
9
+ p as pwd
10
+ };
11
+ //# sourceMappingURL=pwd-9JYDUbov.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pwd-9JYDUbov.js","sources":["../../src/features/shell/commands/pwd.ts"],"sourcesContent":["import { Command } from \"../command\";\n\nexport const pwd = new Command()\n\t.setManual({\n\t\tpurpose: \"Display path of the current directory\",\n\t})\n\t.setExecute(function(_arguments, { workingDirectory: currentDirectory, stdout }) {\n\t\tlet path = currentDirectory.absolutePath;\n\n\t\tif (currentDirectory.root) {\n\t\t\tpath = \"/\";\n\t\t}\n\n\t\tstdout.write(path);\n\t});"],"names":["pwd","Command","_arguments","currentDirectory","stdout","path"],"mappings":";AAEO,MAAMA,IAAM,IAAIC,EAAA,EACrB,UAAU;AAAA,EACV,SAAS;AACV,CAAC,EACA,WAAW,SAASC,GAAY,EAAE,kBAAkBC,GAAkB,QAAAC,KAAU;AAChF,MAAIC,IAAOF,EAAiB;AAE5B,EAAIA,EAAiB,SACpBE,IAAO,MAGRD,EAAO,MAAMC,CAAI;AAClB,CAAC;"}
@@ -0,0 +1,10 @@
1
+ import { Command as e, reloadViewport as o } from "../main.js";
2
+ const r = new e().setManual({
3
+ purpose: "Reboot the system"
4
+ }).setExecute(function() {
5
+ o();
6
+ });
7
+ export {
8
+ r as reboot
9
+ };
10
+ //# sourceMappingURL=reboot-nbAmZck6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reboot-nbAmZck6.js","sources":["../../src/features/shell/commands/reboot.ts"],"sourcesContent":["import { reloadViewport } from \"../../_utils\";\nimport { Command } from \"../command\";\n\nexport const reboot = new Command()\n\t.setManual({\n\t\tpurpose: \"Reboot the system\",\n\t})\n\t.setExecute(function() {\n\t\treloadViewport();\n\t});"],"names":["reboot","Command","reloadViewport"],"mappings":";AAGO,MAAMA,IAAS,IAAIC,EAAA,EACxB,UAAU;AAAA,EACV,SAAS;AACV,CAAC,EACA,WAAW,WAAW;AACtB,EAAAC,EAAA;AACD,CAAC;"}
@@ -0,0 +1,10 @@
1
+ import { Command as e, CommandsManager as o } from "../main.js";
2
+ const n = new e().setManual({
3
+ purpose: "Reload the terminal"
4
+ }).setExecute(function() {
5
+ o.reload();
6
+ });
7
+ export {
8
+ n as reload
9
+ };
10
+ //# sourceMappingURL=reload-CjTJVt5Z.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reload-CjTJVt5Z.js","sources":["../../src/features/shell/commands/reload.ts"],"sourcesContent":["import { Command } from \"../command\";\nimport { CommandsManager } from \"../commands\";\n\nexport const reload = new Command()\n\t.setManual({\n\t\tpurpose: \"Reload the terminal\",\n\t})\n\t.setExecute(function() {\n\t\tCommandsManager.reload();\n\t});"],"names":["reload","Command","CommandsManager"],"mappings":";AAGO,MAAMA,IAAS,IAAIC,EAAA,EACxB,UAAU;AAAA,EACV,SAAS;AACV,CAAC,EACA,WAAW,WAAW;AACtB,EAAAC,EAAgB,OAAA;AACjB,CAAC;"}
@@ -0,0 +1,12 @@
1
+ import { Command as o, Shell as s } from "../main.js";
2
+ const i = new o().setManual({
3
+ purpose: "Display the reverse of a text"
4
+ }).setExecute(function(a, { rawLine: e, stdin: r, stdout: t }) {
5
+ return s.readInput(e, r, (n) => {
6
+ t.write(n.split("").reverse().join(""));
7
+ });
8
+ });
9
+ export {
10
+ i as rev
11
+ };
12
+ //# sourceMappingURL=rev--2pyt1P8.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rev--2pyt1P8.js","sources":["../../src/features/shell/commands/rev.ts"],"sourcesContent":["import { Command } from \"../command\";\nimport { Shell } from \"../shell\";\n\nexport const rev = new Command()\n\t.setManual({\n\t\tpurpose: \"Display the reverse of a text\",\n\t})\n\t.setExecute(function(_args, { rawLine, stdin, stdout }) {\n\t\treturn Shell.readInput(rawLine, stdin, (text) => {\n\t\t\tstdout.write(text.split(\"\").reverse().join(\"\"));\n\t\t});\n\t});"],"names":["rev","Command","_args","rawLine","stdin","stdout","Shell","text"],"mappings":";AAGO,MAAMA,IAAM,IAAIC,EAAA,EACrB,UAAU;AAAA,EACV,SAAS;AACV,CAAC,EACA,WAAW,SAASC,GAAO,EAAE,SAAAC,GAAS,OAAAC,GAAO,QAAAC,KAAU;AACvD,SAAOC,EAAM,UAAUH,GAASC,GAAO,CAACG,MAAS;AAChD,IAAAF,EAAO,MAAME,EAAK,MAAM,EAAE,EAAE,QAAA,EAAU,KAAK,EAAE,CAAC;AAAA,EAC/C,CAAC;AACF,CAAC;"}
@@ -0,0 +1,13 @@
1
+ import { Command as l, VirtualFile as u, Shell as f } from "../main.js";
2
+ const a = new l().setRequireArgs(!0).setManual({
3
+ purpose: "Remove a file"
4
+ }).setExecute(function(i, { workingDirectory: n, stderr: r }) {
5
+ const e = i[0], { name: o, extension: s } = u.splitId(e), t = n.findFile(o, s);
6
+ if (!t)
7
+ return f.writeError(r, this.name, `${e}: No such file`);
8
+ t.delete();
9
+ });
10
+ export {
11
+ a as rm
12
+ };
13
+ //# sourceMappingURL=rm-Uxuv-dEz.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rm-Uxuv-dEz.js","sources":["../../src/features/shell/commands/rm.ts"],"sourcesContent":["import { VirtualFile } from \"../../virtual-drive\";\nimport { Shell } from \"../shell\";\nimport { Command } from \"../command\";\n\nexport const rm = new Command()\n\t.setRequireArgs(true)\n\t.setManual({\n\t\tpurpose: \"Remove a file\",\n\t})\n\t.setExecute(function(this: Command, args, { workingDirectory, stderr }) {\n\t\tconst fileId = args[0];\n\t\tconst { name, extension } = VirtualFile.splitId(fileId);\n\t\tconst file = workingDirectory.findFile(name, extension);\n\t\n\t\tif (!file) {\n\t\t\treturn Shell.writeError(stderr, this.name, `${fileId}: No such file`);\n\t\t}\n\t\t\n\t\tfile.delete();\n\t});"],"names":["rm","Command","args","workingDirectory","stderr","fileId","name","extension","VirtualFile","file","Shell"],"mappings":";AAIO,MAAMA,IAAK,IAAIC,EAAA,EACpB,eAAe,EAAI,EACnB,UAAU;AAAA,EACV,SAAS;AACV,CAAC,EACA,WAAW,SAAwBC,GAAM,EAAE,kBAAAC,GAAkB,QAAAC,KAAU;AACvE,QAAMC,IAASH,EAAK,CAAC,GACf,EAAE,MAAAI,GAAM,WAAAC,EAAA,IAAcC,EAAY,QAAQH,CAAM,GAChDI,IAAON,EAAiB,SAASG,GAAMC,CAAS;AAEtD,MAAI,CAACE;AACJ,WAAOC,EAAM,WAAWN,GAAQ,KAAK,MAAM,GAAGC,CAAM,gBAAgB;AAGrE,EAAAI,EAAK,OAAA;AACN,CAAC;"}
@@ -0,0 +1,13 @@
1
+ import { Command as i, Shell as s } from "../main.js";
2
+ const u = new i().setRequireArgs(!0).setManual({
3
+ purpose: "Remove a directory"
4
+ }).setExecute(function(o, { workingDirectory: t, stderr: n }) {
5
+ const e = o[0], r = t.findSubFolder(e);
6
+ if (!r)
7
+ return s.writeError(n, this.name, `${e}: No such directory`);
8
+ r.delete();
9
+ });
10
+ export {
11
+ u as rmdir
12
+ };
13
+ //# sourceMappingURL=rmdir-BYWer3pb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rmdir-BYWer3pb.js","sources":["../../src/features/shell/commands/rmdir.ts"],"sourcesContent":["import { Shell } from \"../shell\";\nimport { Command } from \"../command\";\n\nexport const rmdir = new Command()\n\t.setRequireArgs(true)\n\t.setManual({\n\t\tpurpose: \"Remove a directory\",\n\t})\n\t.setExecute(function(this: Command, args, { workingDirectory, stderr }) {\n\t\tconst folderName = args[0];\n\t\tconst folder = workingDirectory.findSubFolder(folderName);\n\t\n\t\tif (!folder) {\n\t\t\treturn Shell.writeError(stderr, this.name, `${folderName}: No such directory`);\n\t\t}\n\t\t\n\t\tfolder.delete();\n\t});"],"names":["rmdir","Command","args","workingDirectory","stderr","folderName","folder","Shell"],"mappings":";AAGO,MAAMA,IAAQ,IAAIC,EAAA,EACvB,eAAe,EAAI,EACnB,UAAU;AAAA,EACV,SAAS;AACV,CAAC,EACA,WAAW,SAAwBC,GAAM,EAAE,kBAAAC,GAAkB,QAAAC,KAAU;AACvE,QAAMC,IAAaH,EAAK,CAAC,GACnBI,IAASH,EAAiB,cAAcE,CAAU;AAExD,MAAI,CAACC;AACJ,WAAOC,EAAM,WAAWH,GAAQ,KAAK,MAAM,GAAGC,CAAU,qBAAqB;AAG9E,EAAAC,EAAO,OAAA;AACR,CAAC;"}
@@ -0,0 +1,15 @@
1
+ import { Command as o, Shell as t } from "../main.js";
2
+ const u = new o().setManual({
3
+ purpose: "Execute a shell script"
4
+ }).setRequireArgs(!0).setExecute(async function(r, { stderr: n, workingDirectory: i, shell: s }) {
5
+ const a = r[0], e = i.navigateToFile(a);
6
+ if (!e) {
7
+ t.writeError(n, this.name, t.INVALID_PATH_ERROR);
8
+ return;
9
+ }
10
+ return await s.interpreter.executeScript(e);
11
+ });
12
+ export {
13
+ u as sh
14
+ };
15
+ //# sourceMappingURL=sh-B67OTc-j.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sh-B67OTc-j.js","sources":["../../src/features/shell/commands/sh.ts"],"sourcesContent":["import { Command } from \"../command\";\nimport { Shell } from \"../shell\";\n\nexport const sh = new Command()\n\t.setManual({\n\t\tpurpose: \"Execute a shell script\",\n\t})\n\t.setRequireArgs(true)\n\t.setExecute(async function(this: Command, args, { stderr, workingDirectory, shell }) {\n\t\tconst path = args[0];\n\t\tconst file = workingDirectory.navigateToFile(path);\n\n\t\tif (!file) {\n\t\t\tShell.writeError(stderr, this.name, Shell.INVALID_PATH_ERROR);\n\t\t\treturn;\n\t\t}\n\n\t\treturn await shell.interpreter.executeScript(file);\n\t});"],"names":["sh","Command","args","stderr","workingDirectory","shell","path","file","Shell"],"mappings":";AAGO,MAAMA,IAAK,IAAIC,EAAA,EACpB,UAAU;AAAA,EACV,SAAS;AACV,CAAC,EACA,eAAe,EAAI,EACnB,WAAW,eAA8BC,GAAM,EAAE,QAAAC,GAAQ,kBAAAC,GAAkB,OAAAC,KAAS;AACpF,QAAMC,IAAOJ,EAAK,CAAC,GACbK,IAAOH,EAAiB,eAAeE,CAAI;AAEjD,MAAI,CAACC,GAAM;AACV,IAAAC,EAAM,WAAWL,GAAQ,KAAK,MAAMK,EAAM,kBAAkB;AAC5D;AAAA,EACD;AAEA,SAAO,MAAMH,EAAM,YAAY,cAAcE,CAAI;AAClD,CAAC;"}
@@ -0,0 +1,168 @@
1
+ import { parseOptionalFloat as w } from "@prozilla-os/shared";
2
+ import { Command as I, Shell as h } from "../main.js";
3
+ const p = 1.25, m = [
4
+ [
5
+ " (@@) ( ) (@) ( ) @@ () @ o @ o",
6
+ " ( )",
7
+ " (@@@@)",
8
+ " ( )",
9
+ "",
10
+ " (@@@)"
11
+ ],
12
+ [
13
+ " ( ) (@@) ( ) (@) () @@ o @ o @",
14
+ " (@@@)",
15
+ " ( )",
16
+ " (@@@@)",
17
+ "",
18
+ " ( )"
19
+ ]
20
+ ], d = [
21
+ " ==== ________ ___________",
22
+ " _D _| |_______/ \\__I_I_____===__|_________|",
23
+ " |(_)--- | H\\________/ | | =|___ ___| ",
24
+ " / | | H | | | | ||_| |_|| ",
25
+ " | | | H |__--------------------| [___] | ",
26
+ " | ________|___H__/__|_____/[][]~\\_______| | ",
27
+ " |/ | |-----------I_____I [][] [] D |=======|__"
28
+ ], u = [
29
+ [
30
+ "__/ =| o |=-~~\\ /~~\\ /~~\\ /~~\\ ____Y___________|__",
31
+ " |/-=|___|= || || || |_____/~\\___/ ",
32
+ " \\_/ \\O=====O=====O=====O_/ \\_/ "
33
+ ],
34
+ [
35
+ "__/ =| o |=-~~\\ /~~\\ /~~\\ /~~\\ ____Y___________|__",
36
+ " |/-=|___|=O=====O=====O=====O |_____/~\\___/ ",
37
+ " \\_/ \\__/ \\__/ \\__/ \\__/ \\_/ "
38
+ ],
39
+ [
40
+ "__/ =| o |=-O=====O=====O=====O \\ ____Y___________|__",
41
+ " |/-=|___|= || || || |_____/~\\___/ ",
42
+ " \\_/ \\__/ \\__/ \\__/ \\__/ \\_/ "
43
+ ],
44
+ [
45
+ "__/ =| o |=-~O=====O=====O=====O\\ ____Y___________|__",
46
+ " |/-=|___|= || || || |_____/~\\___/ ",
47
+ " \\_/ \\__/ \\__/ \\__/ \\__/ \\_/ "
48
+ ],
49
+ [
50
+ "__/ =| o |=-~~\\ /~~\\ /~~\\ /~~\\ ____Y___________|__",
51
+ " |/-=|___|= O=====O=====O=====O|_____/~\\___/ ",
52
+ " \\_/ \\__/ \\__/ \\__/ \\__/ \\_/ "
53
+ ],
54
+ [
55
+ "__/ =| o |=-~~\\ /~~\\ /~~\\ /~~\\ ____Y___________|__",
56
+ " |/-=|___|= || || || |_____/~\\___/ ",
57
+ " \\_/ \\_O=====O=====O=====O/ \\_/ "
58
+ ]
59
+ ].reverse(), f = [
60
+ " ",
61
+ " _________________ ",
62
+ " _| \\_____A ",
63
+ " =| | ",
64
+ " -| | ",
65
+ "__|________________________|_",
66
+ "|__________________________|_",
67
+ " |_D__D__D_| |_D__D__D_| ",
68
+ " \\_/ \\_/ \\_/ \\_/ "
69
+ ], H = [
70
+ [
71
+ " _______================_______ ",
72
+ " | | ___ ___ ___ ___ | | ",
73
+ " | | | | | | | | | | | | ",
74
+ " | | |_| |_| |_| |_| | | ",
75
+ " | | | | ",
76
+ "__|__|____________________|__|__",
77
+ "_|____________________________|_",
78
+ " |_D__D__D_| |_D__D__D_| ",
79
+ " \\_/ \\_/ \\_/ \\_/ "
80
+ ],
81
+ [
82
+ " ",
83
+ " ________========__HH____ ",
84
+ " / HH \\ ",
85
+ "/ HH \\ ",
86
+ "\\ HH / ",
87
+ "_\\__________________HH____/__",
88
+ "|__________________________|_",
89
+ " |_D__D__D_| |_D__D__D_| ",
90
+ " \\_/ \\_/ \\_/ \\_/ "
91
+ ],
92
+ [
93
+ " ",
94
+ " ",
95
+ " ",
96
+ " ",
97
+ " ",
98
+ "_____________________________",
99
+ "|__________________________|_",
100
+ " |_D__D__D_| |_D__D__D_| ",
101
+ " \\_/ \\_/ \\_/ \\_/ "
102
+ ],
103
+ [
104
+ " ",
105
+ " _|__|___________|__|___ ",
106
+ " (_|__|___________|__|___) ",
107
+ " _(|__|___________|__|__)_ ",
108
+ " (__|__|___________|__|____)",
109
+ "_(___|__|___________|__|__)__",
110
+ "|__________________________|_",
111
+ " |_D__D__D_| |_D__D__D_| ",
112
+ " \\_/ \\_/ \\_/ \\_/ "
113
+ ],
114
+ [
115
+ " ",
116
+ " ___________________________ ",
117
+ " \\ | | / ",
118
+ " \\ | | / ",
119
+ " |\\ | | /| ",
120
+ "__|_\\___|___________|___/_|__",
121
+ "|__________________________|_",
122
+ " |_D__D__D_| |_D__D__D_| ",
123
+ " \\_/ \\_/ \\_/ \\_/ "
124
+ ]
125
+ ];
126
+ function S(e, t = 1, O = 50) {
127
+ const r = m[0].length, a = d.length + u[0].length, D = f.length, _ = r + a - D, g = m[Math.round(e / 4) % m.length], c = d, i = u[e % u.length], s = O - e;
128
+ return `
129
+ ${g.concat(c, i).map((o, l) => {
130
+ if (l >= _ && t > 0)
131
+ for (let n = 0; n < t; n++)
132
+ n === 0 ? o += f[l - _] : o += H[(n - 1) % H.length][l - _];
133
+ return s === 0 ? o : s > 0 ? " ".repeat(s) + o : (o = o.slice(-s), o);
134
+ }).join(`
135
+ `)}
136
+ `;
137
+ }
138
+ const T = new I().setManual({
139
+ purpose: "Show animations aimed to correct users who accidentally enter sl instead of ls. SL stands for Steam Locomotive.",
140
+ usage: "sl [ -w ]",
141
+ options: {
142
+ "-w number": "Set the amount of wagons (defaults to 1)",
143
+ "-s speed": `Set the speed of the locomotive (Defaults to ${p})`
144
+ }
145
+ }).addOption({
146
+ short: "w",
147
+ long: "wagons",
148
+ isInput: !0
149
+ }).addOption({
150
+ short: "s",
151
+ long: "speed",
152
+ isInput: !0
153
+ }).setExecute(function(e, { inputs: t, size: O, stderr: r, stdout: a, stdin: D }) {
154
+ let _ = 1;
155
+ if (t.w && (_ = parseInt(t.w), !_ || _ < 0))
156
+ return h.writeError(r, this.name, "Please specify a valid amount of wagons");
157
+ const c = 100 / w(t.s, p);
158
+ return h.animate({
159
+ stdin: D,
160
+ stdout: a,
161
+ delay: c,
162
+ render: (i) => S(i, _, O.x)
163
+ });
164
+ });
165
+ export {
166
+ T as sl
167
+ };
168
+ //# sourceMappingURL=sl-CLAmugya.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sl-CLAmugya.js","sources":["../../src/features/shell/commands/sl.ts"],"sourcesContent":["import { parseOptionalFloat } from \"@prozilla-os/shared\";\nimport { Shell } from \"../shell\";\nimport { Command } from \"../command\";\n\nconst ANIMATION_SPEED = 1.25;\n\nconst LOCOMOTIVE_SMOKE = [\n\t[\n\t\t\" (@@) ( ) (@) ( ) @@ () @ o @ o\",\n\t\t\" ( )\",\n\t\t\" (@@@@)\",\n\t\t\" ( )\",\n\t\t\"\",\n\t\t\" (@@@)\",\n\t],\n\t[\n\t\t\" ( ) (@@) ( ) (@) () @@ o @ o @\",\n\t\t\" (@@@)\",\n\t\t\" ( )\",\n\t\t\" (@@@@)\",\n\t\t\"\",\n\t\t\" ( )\",\n\t],\n];\n\nconst LOCOMOTIVE_TOP = [\n\t\" ==== ________ ___________\",\n\t\" _D _| |_______/ \\\\__I_I_____===__|_________|\",\n\t\" |(_)--- | H\\\\________/ | | =|___ ___| \",\n\t\" / | | H | | | | ||_| |_|| \",\n\t\" | | | H |__--------------------| [___] | \",\n\t\" | ________|___H__/__|_____/[][]~\\\\_______| | \",\n\t\" |/ | |-----------I_____I [][] [] D |=======|__\",\n];\n\nconst LOCOMOTIVE_BOTTOM = [\n\t[\n\t\t\"__/ =| o |=-~~\\\\ /~~\\\\ /~~\\\\ /~~\\\\ ____Y___________|__\",\n\t\t\" |/-=|___|= || || || |_____/~\\\\___/ \",\n\t\t\" \\\\_/ \\\\O=====O=====O=====O_/ \\\\_/ \",\n\t],\n\t[\n\t\t\"__/ =| o |=-~~\\\\ /~~\\\\ /~~\\\\ /~~\\\\ ____Y___________|__\",\n\t\t\" |/-=|___|=O=====O=====O=====O |_____/~\\\\___/ \",\n\t\t\" \\\\_/ \\\\__/ \\\\__/ \\\\__/ \\\\__/ \\\\_/ \",\n\t],\n\t[\n\t\t\"__/ =| o |=-O=====O=====O=====O \\\\ ____Y___________|__\",\n\t\t\" |/-=|___|= || || || |_____/~\\\\___/ \",\n\t\t\" \\\\_/ \\\\__/ \\\\__/ \\\\__/ \\\\__/ \\\\_/ \",\n\t],\n\t[\n\t\t\"__/ =| o |=-~O=====O=====O=====O\\\\ ____Y___________|__\",\n\t\t\" |/-=|___|= || || || |_____/~\\\\___/ \",\n\t\t\" \\\\_/ \\\\__/ \\\\__/ \\\\__/ \\\\__/ \\\\_/ \",\n\t],\n\t[\n\t\t\"__/ =| o |=-~~\\\\ /~~\\\\ /~~\\\\ /~~\\\\ ____Y___________|__\",\n\t\t\" |/-=|___|= O=====O=====O=====O|_____/~\\\\___/ \",\n\t\t\" \\\\_/ \\\\__/ \\\\__/ \\\\__/ \\\\__/ \\\\_/ \",\n\t],\n\t[\n\t\t\"__/ =| o |=-~~\\\\ /~~\\\\ /~~\\\\ /~~\\\\ ____Y___________|__\",\n\t\t\" |/-=|___|= || || || |_____/~\\\\___/ \",\n\t\t\" \\\\_/ \\\\_O=====O=====O=====O/ \\\\_/ \",\n\t],\n].reverse();\n\nconst COAL_WAGON = [\n\t\" \",\n\t\" _________________ \",\n\t\" _| \\\\_____A \",\n\t\" =| | \",\n\t\" -| | \",\n\t\"__|________________________|_\",\n\t\"|__________________________|_\",\n\t\" |_D__D__D_| |_D__D__D_| \",\n\t\" \\\\_/ \\\\_/ \\\\_/ \\\\_/ \",\n];\n\nconst EXTRA_WAGONS = [\n\t[\n\t\t\" _______================_______ \",\n\t\t\" | | ___ ___ ___ ___ | | \",\n\t\t\" | | | | | | | | | | | | \",\n\t\t\" | | |_| |_| |_| |_| | | \",\n\t\t\" | | | | \",\n\t\t\"__|__|____________________|__|__\",\n\t\t\"_|____________________________|_\",\n\t\t\" |_D__D__D_| |_D__D__D_| \",\n\t\t\" \\\\_/ \\\\_/ \\\\_/ \\\\_/ \",\n\t],\n\t[\n\t\t\" \",\n\t\t\" ________========__HH____ \",\n\t\t\" / HH \\\\ \",\n\t\t\"/ HH \\\\ \",\n\t\t\"\\\\ HH / \",\n\t\t\"_\\\\__________________HH____/__\",\n\t\t\"|__________________________|_\",\n\t\t\" |_D__D__D_| |_D__D__D_| \",\n\t\t\" \\\\_/ \\\\_/ \\\\_/ \\\\_/ \",\n\t],\n\t[\n\t\t\" \",\n\t\t\" \",\n\t\t\" \",\n\t\t\" \",\n\t\t\" \",\n\t\t\"_____________________________\",\n\t\t\"|__________________________|_\",\n\t\t\" |_D__D__D_| |_D__D__D_| \",\n\t\t\" \\\\_/ \\\\_/ \\\\_/ \\\\_/ \",\n\t],\n\t[\n\t\t\" \",\n\t\t\" _|__|___________|__|___ \",\n\t\t\" (_|__|___________|__|___) \",\n\t\t\" _(|__|___________|__|__)_ \",\n\t\t\" (__|__|___________|__|____)\",\n\t\t\"_(___|__|___________|__|__)__\",\n\t\t\"|__________________________|_\",\n\t\t\" |_D__D__D_| |_D__D__D_| \",\n\t\t\" \\\\_/ \\\\_/ \\\\_/ \\\\_/ \",\n\t],\n\t[\n\t\t\" \",\n\t\t\" ___________________________ \",\n\t\t\" \\\\ | | / \",\n\t\t\" \\\\ | | / \",\n\t\t\" |\\\\ | | /| \",\n\t\t\"__|_\\\\___|___________|___/_|__\",\n\t\t\"|__________________________|_\",\n\t\t\" |_D__D__D_| |_D__D__D_| \",\n\t\t\" \\\\_/ \\\\_/ \\\\_/ \\\\_/ \",\n\t],\n];\n\nfunction generateLocomotive(frame: number, wagonCount = 1, start = 50) {\n\tconst smokeHeight = LOCOMOTIVE_SMOKE[0].length;\n\tconst locomotiveHeight = LOCOMOTIVE_TOP.length + LOCOMOTIVE_BOTTOM[0].length;\n\tconst wagonHeight = COAL_WAGON.length;\n\n\tconst wagonStart = smokeHeight + locomotiveHeight - wagonHeight;\n\n\tconst smoke = LOCOMOTIVE_SMOKE[Math.round(frame / 4) % LOCOMOTIVE_SMOKE.length];\n\tconst top = LOCOMOTIVE_TOP;\n\tconst bottom = LOCOMOTIVE_BOTTOM[frame % LOCOMOTIVE_BOTTOM.length];\n\n\tconst distance = start - frame;\n\tconst locomotive = smoke.concat(top, bottom).map((line, index) => {\n\t\tif (index >= wagonStart && wagonCount > 0) {\n\t\t\tfor (let i = 0; i < wagonCount; i++) {\n\t\t\t\tif (i === 0) {\n\t\t\t\t\tline += COAL_WAGON[index - wagonStart];\n\t\t\t\t} else {\n\t\t\t\t\tline += EXTRA_WAGONS[(i - 1) % EXTRA_WAGONS.length][index - wagonStart];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (distance === 0) {\n\t\t\treturn line;\n\t\t} else if (distance > 0) {\n\t\t\treturn \" \".repeat(distance) + line;\n\t\t} else {\n\t\t\tline = line.slice(-distance);\n\t\t\treturn line;\n\t\t}\n\t}).join(\"\\n\");\n\n\treturn `\\n${locomotive}\\n`;\n}\n\nexport const sl = new Command()\n\t.setManual({\n\t\tpurpose: \"Show animations aimed to correct users who accidentally enter sl instead of ls. SL stands for Steam Locomotive.\",\n\t\tusage: \"sl [ -w ]\",\n\t\toptions: {\n\t\t\t\"-w number\": \"Set the amount of wagons (defaults to 1)\",\n\t\t\t\"-s speed\": `Set the speed of the locomotive (Defaults to ${ANIMATION_SPEED})`,\n\t\t},\n\t})\n\t.addOption({\n\t\tshort: \"w\",\n\t\tlong: \"wagons\",\n\t\tisInput: true,\n\t})\n\t.addOption({\n\t\tshort: \"s\",\n\t\tlong: \"speed\",\n\t\tisInput: true,\n\t})\n\t.setExecute(function(this: Command, _args, { inputs, size, stderr, stdout, stdin }) {\n\t\tlet wagonCount = 1;\n\n\t\tif (inputs.w) {\n\t\t\twagonCount = parseInt(inputs.w);\n\n\t\t\tif (!wagonCount || wagonCount < 0) {\n\t\t\t\treturn Shell.writeError(stderr, this.name, \"Please specify a valid amount of wagons\"); \n\t\t\t}\n\t\t}\n\n\t\tconst speed = parseOptionalFloat(inputs.s, ANIMATION_SPEED);\n\t\tconst delay = 100 / speed;\n\n\t\treturn Shell.animate({\n\t\t\tstdin,\n\t\t\tstdout,\n\t\t\tdelay,\n\t\t\trender: (frame) => generateLocomotive(frame, wagonCount, size.x),\n\t\t});\n\t});"],"names":["ANIMATION_SPEED","LOCOMOTIVE_SMOKE","LOCOMOTIVE_TOP","LOCOMOTIVE_BOTTOM","COAL_WAGON","EXTRA_WAGONS","generateLocomotive","frame","wagonCount","start","smokeHeight","locomotiveHeight","wagonHeight","wagonStart","smoke","top","bottom","distance","line","index","i","sl","Command","_args","inputs","size","stderr","stdout","stdin","Shell","delay","parseOptionalFloat"],"mappings":";;AAIA,MAAMA,IAAkB,MAElBC,IAAmB;AAAA,EACxB;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAAA,EAED;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEF,GAEMC,IAAiB;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAEMC,IAAoB;AAAA,EACzB;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAAA,EAED;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAAA,EAED;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAAA,EAED;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAAA,EAED;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAAA,EAED;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEF,EAAE,QAAA,GAEIC,IAAa;AAAA,EAClB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,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ErCK,KAAQb,GAAce,IAAI,KAAKf,EAAa,MAAM,EAAEc,IAAQN,CAAU;AAKzE,WAAII,MAAa,IACTC,IACGD,IAAW,IACd,IAAI,OAAOA,CAAQ,IAAIC,KAE9BA,IAAOA,EAAK,MAAM,CAACD,CAAQ,GACpBC;AAAA,EAET,CAAC,EAAE,KAAK;AAAA,CAAI,CAEU;AAAA;AACvB;AAEO,MAAMG,IAAK,IAAIC,EAAA,EACpB,UAAU;AAAA,EACV,SAAS;AAAA,EACT,OAAO;AAAA,EACP,SAAS;AAAA,IACR,aAAa;AAAA,IACb,YAAY,gDAAgDtB,CAAe;AAAA,EAAA;AAE7E,CAAC,EACA,UAAU;AAAA,EACV,OAAO;AAAA,EACP,MAAM;AAAA,EACN,SAAS;AACV,CAAC,EACA,UAAU;AAAA,EACV,OAAO;AAAA,EACP,MAAM;AAAA,EACN,SAAS;AACV,CAAC,EACA,WAAW,SAAwBuB,GAAO,EAAE,QAAAC,GAAQ,MAAAC,GAAM,QAAAC,GAAQ,QAAAC,GAAQ,OAAAC,KAAS;AACnF,MAAIpB,IAAa;AAEjB,MAAIgB,EAAO,MACVhB,IAAa,SAASgB,EAAO,CAAC,GAE1B,CAAChB,KAAcA,IAAa;AAC/B,WAAOqB,EAAM,WAAWH,GAAQ,KAAK,MAAM,yCAAyC;AAKtF,QAAMI,IAAQ,MADAC,EAAmBP,EAAO,GAAGxB,CAAe;AAG1D,SAAO6B,EAAM,QAAQ;AAAA,IACpB,OAAAD;AAAA,IACA,QAAAD;AAAA,IACA,OAAAG;AAAA,IACA,QAAQ,CAACvB,MAAUD,EAAmBC,GAAOC,GAAYiB,EAAK,CAAC;AAAA,EAAA,CAC/D;AACF,CAAC;"}
@@ -0,0 +1,15 @@
1
+ import { Command as o, VirtualFile as a } from "../main.js";
2
+ const r = new o().setRequireArgs(!0).setManual({
3
+ purpose: "Change file timestamps",
4
+ usage: "touch [options] files",
5
+ description: `Update the access and modification times of each FILE to the current time.
6
+
7
+ A file argument that does not exist is created empty.`
8
+ }).setExecute(function(n, { workingDirectory: e }) {
9
+ const s = n[0], { name: t, extension: i } = a.splitId(s);
10
+ e.findFile(t, i) || e.createFile(t, i);
11
+ });
12
+ export {
13
+ r as touch
14
+ };
15
+ //# sourceMappingURL=touch-BReUyL_z.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"touch-BReUyL_z.js","sources":["../../src/features/shell/commands/touch.ts"],"sourcesContent":["import { VirtualFile } from \"../../virtual-drive\";\nimport { Command } from \"../command\";\n\nexport const touch = new Command()\n\t.setRequireArgs(true)\n\t.setManual({\n\t\tpurpose: \"Change file timestamps\",\n\t\tusage: \"touch [options] files\",\n\t\tdescription: \"Update the access and modification times of each FILE to the current time.\\n\\n\"\n + \"A file argument that does not exist is created empty.\",\n\t})\n\t.setExecute(function(this: Command, args, { workingDirectory }) {\n\t\tconst fileId = args[0];\n\t\tconst { name, extension } = VirtualFile.splitId(fileId);\n \n\t\tif (workingDirectory.findFile(name, extension))\n\t\t\treturn;\n \n\t\tworkingDirectory.createFile(name, extension as string | undefined);\n\t});"],"names":["touch","Command","args","workingDirectory","fileId","name","extension","VirtualFile"],"mappings":";AAGO,MAAMA,IAAQ,IAAIC,EAAA,EACvB,eAAe,EAAI,EACnB,UAAU;AAAA,EACV,SAAS;AAAA,EACT,OAAO;AAAA,EACP,aAAa;AAAA;AAAA;AAEd,CAAC,EACA,WAAW,SAAwBC,GAAM,EAAE,kBAAAC,KAAoB;AAC/D,QAAMC,IAASF,EAAK,CAAC,GACf,EAAE,MAAAG,GAAM,WAAAC,EAAA,IAAcC,EAAY,QAAQH,CAAM;AAEtD,EAAID,EAAiB,SAASE,GAAMC,CAAS,KAG7CH,EAAiB,WAAWE,GAAMC,CAA+B;AAClE,CAAC;"}