typescript-virtual-container 1.2.9 → 1.3.0

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 (281) hide show
  1. package/.vscode/settings.json +0 -1
  2. package/README.md +141 -50
  3. package/biome.json +7 -0
  4. package/dist/SSHMimic/exec.d.ts.map +1 -1
  5. package/dist/SSHMimic/executor.d.ts.map +1 -1
  6. package/dist/SSHMimic/executor.js +32 -16
  7. package/dist/SSHMimic/index.d.ts.map +1 -1
  8. package/dist/SSHMimic/index.js +20 -6
  9. package/dist/VirtualFileSystem/binaryPack.d.ts.map +1 -1
  10. package/dist/VirtualFileSystem/binaryPack.js +29 -6
  11. package/dist/VirtualFileSystem/index.d.ts.map +1 -1
  12. package/dist/VirtualFileSystem/index.js +36 -13
  13. package/dist/VirtualPackageManager/index.d.ts.map +1 -1
  14. package/dist/VirtualPackageManager/index.js +192 -43
  15. package/dist/VirtualShell/index.d.ts +10 -4
  16. package/dist/VirtualShell/index.d.ts.map +1 -1
  17. package/dist/VirtualShell/index.js +18 -7
  18. package/dist/VirtualShell/shell.d.ts.map +1 -1
  19. package/dist/VirtualShell/shell.js +3 -1
  20. package/dist/VirtualShell/shellParser.d.ts.map +1 -1
  21. package/dist/VirtualUserManager/index.d.ts.map +1 -1
  22. package/dist/commands/adduser.d.ts +6 -0
  23. package/dist/commands/adduser.d.ts.map +1 -1
  24. package/dist/commands/adduser.js +6 -0
  25. package/dist/commands/alias.d.ts +5 -0
  26. package/dist/commands/alias.d.ts.map +1 -1
  27. package/dist/commands/alias.js +5 -0
  28. package/dist/commands/apt.d.ts +5 -0
  29. package/dist/commands/apt.d.ts.map +1 -1
  30. package/dist/commands/apt.js +32 -9
  31. package/dist/commands/awk.d.ts +11 -0
  32. package/dist/commands/awk.d.ts.map +1 -1
  33. package/dist/commands/awk.js +15 -2
  34. package/dist/commands/base64.d.ts +5 -0
  35. package/dist/commands/base64.d.ts.map +1 -1
  36. package/dist/commands/base64.js +9 -1
  37. package/dist/commands/cat.d.ts +5 -0
  38. package/dist/commands/cat.d.ts.map +1 -1
  39. package/dist/commands/cat.js +10 -2
  40. package/dist/commands/cd.d.ts +5 -0
  41. package/dist/commands/cd.d.ts.map +1 -1
  42. package/dist/commands/cd.js +5 -0
  43. package/dist/commands/chmod.d.ts +5 -0
  44. package/dist/commands/chmod.d.ts.map +1 -1
  45. package/dist/commands/chmod.js +5 -0
  46. package/dist/commands/cp.d.ts +5 -0
  47. package/dist/commands/cp.d.ts.map +1 -1
  48. package/dist/commands/cp.js +5 -0
  49. package/dist/commands/curl.d.ts +5 -0
  50. package/dist/commands/curl.d.ts.map +1 -1
  51. package/dist/commands/curl.js +34 -6
  52. package/dist/commands/cut.d.ts +5 -0
  53. package/dist/commands/cut.d.ts.map +1 -1
  54. package/dist/commands/cut.js +8 -1
  55. package/dist/commands/date.d.ts +5 -0
  56. package/dist/commands/date.d.ts.map +1 -1
  57. package/dist/commands/date.js +7 -1
  58. package/dist/commands/declare.d.ts +3 -0
  59. package/dist/commands/declare.d.ts.map +1 -0
  60. package/dist/commands/declare.js +39 -0
  61. package/dist/commands/diff.d.ts +5 -0
  62. package/dist/commands/diff.d.ts.map +1 -1
  63. package/dist/commands/diff.js +5 -0
  64. package/dist/commands/dpkg.d.ts +5 -0
  65. package/dist/commands/dpkg.d.ts.map +1 -1
  66. package/dist/commands/dpkg.js +24 -7
  67. package/dist/commands/du.d.ts.map +1 -1
  68. package/dist/commands/du.js +8 -2
  69. package/dist/commands/echo.d.ts +5 -0
  70. package/dist/commands/echo.d.ts.map +1 -1
  71. package/dist/commands/echo.js +13 -4
  72. package/dist/commands/env.d.ts +5 -0
  73. package/dist/commands/env.d.ts.map +1 -1
  74. package/dist/commands/env.js +11 -1
  75. package/dist/commands/exit.d.ts +5 -0
  76. package/dist/commands/exit.d.ts.map +1 -1
  77. package/dist/commands/exit.js +12 -2
  78. package/dist/commands/export.d.ts.map +1 -1
  79. package/dist/commands/export.js +3 -1
  80. package/dist/commands/find.d.ts +5 -0
  81. package/dist/commands/find.d.ts.map +1 -1
  82. package/dist/commands/find.js +5 -0
  83. package/dist/commands/free.d.ts +5 -0
  84. package/dist/commands/free.d.ts.map +1 -1
  85. package/dist/commands/free.js +5 -0
  86. package/dist/commands/grep.d.ts +5 -0
  87. package/dist/commands/grep.d.ts.map +1 -1
  88. package/dist/commands/grep.js +12 -2
  89. package/dist/commands/gzip.d.ts +5 -0
  90. package/dist/commands/gzip.d.ts.map +1 -1
  91. package/dist/commands/gzip.js +18 -2
  92. package/dist/commands/head.d.ts +5 -0
  93. package/dist/commands/head.d.ts.map +1 -1
  94. package/dist/commands/head.js +5 -0
  95. package/dist/commands/help.d.ts.map +1 -1
  96. package/dist/commands/help.js +98 -45
  97. package/dist/commands/history.d.ts +5 -0
  98. package/dist/commands/history.d.ts.map +1 -1
  99. package/dist/commands/history.js +5 -0
  100. package/dist/commands/hostname.d.ts +5 -0
  101. package/dist/commands/hostname.d.ts.map +1 -1
  102. package/dist/commands/hostname.js +5 -0
  103. package/dist/commands/id.d.ts.map +1 -1
  104. package/dist/commands/id.js +4 -1
  105. package/dist/commands/index.d.ts +2 -17
  106. package/dist/commands/index.d.ts.map +1 -1
  107. package/dist/commands/index.js +2 -340
  108. package/dist/commands/ls.d.ts.map +1 -1
  109. package/dist/commands/ls.js +3 -1
  110. package/dist/commands/lsb-release.d.ts.map +1 -1
  111. package/dist/commands/lsb-release.js +8 -2
  112. package/dist/commands/nano.js +1 -1
  113. package/dist/commands/neofetch.js +1 -1
  114. package/dist/commands/node.d.ts +9 -0
  115. package/dist/commands/node.d.ts.map +1 -0
  116. package/dist/commands/node.js +316 -0
  117. package/dist/commands/npm.d.ts +19 -0
  118. package/dist/commands/npm.d.ts.map +1 -0
  119. package/dist/commands/npm.js +109 -0
  120. package/dist/commands/ping.d.ts.map +1 -1
  121. package/dist/commands/ping.js +3 -1
  122. package/dist/commands/printf.d.ts +3 -0
  123. package/dist/commands/printf.d.ts.map +1 -0
  124. package/dist/commands/printf.js +113 -0
  125. package/dist/commands/ps.d.ts.map +1 -1
  126. package/dist/commands/ps.js +4 -1
  127. package/dist/commands/python.d.ts +30 -0
  128. package/dist/commands/python.d.ts.map +1 -0
  129. package/dist/commands/python.js +2058 -0
  130. package/dist/commands/read.d.ts +3 -0
  131. package/dist/commands/read.d.ts.map +1 -0
  132. package/dist/commands/read.js +34 -0
  133. package/dist/commands/registry.d.ts +8 -0
  134. package/dist/commands/registry.d.ts.map +1 -0
  135. package/dist/commands/registry.js +229 -0
  136. package/dist/commands/runtime.d.ts +6 -0
  137. package/dist/commands/runtime.d.ts.map +1 -0
  138. package/dist/commands/runtime.js +280 -0
  139. package/dist/commands/sed.d.ts.map +1 -1
  140. package/dist/commands/sed.js +11 -3
  141. package/dist/commands/set.d.ts.map +1 -1
  142. package/dist/commands/set.js +9 -3
  143. package/dist/commands/sh.d.ts.map +1 -1
  144. package/dist/commands/sh.js +57 -36
  145. package/dist/commands/shift.d.ts +5 -0
  146. package/dist/commands/shift.d.ts.map +1 -0
  147. package/dist/commands/shift.js +52 -0
  148. package/dist/commands/sleep.d.ts.map +1 -1
  149. package/dist/commands/sort.d.ts.map +1 -1
  150. package/dist/commands/sort.js +4 -2
  151. package/dist/commands/source.d.ts.map +1 -1
  152. package/dist/commands/source.js +5 -2
  153. package/dist/commands/sudo.js +1 -1
  154. package/dist/commands/tar.d.ts.map +1 -1
  155. package/dist/commands/tar.js +11 -3
  156. package/dist/commands/tee.d.ts.map +1 -1
  157. package/dist/commands/tee.js +8 -6
  158. package/dist/commands/test.d.ts.map +1 -1
  159. package/dist/commands/test.js +46 -24
  160. package/dist/commands/tr.d.ts.map +1 -1
  161. package/dist/commands/tr.js +3 -1
  162. package/dist/commands/true.d.ts +4 -0
  163. package/dist/commands/true.d.ts.map +1 -0
  164. package/dist/commands/true.js +14 -0
  165. package/dist/commands/type.d.ts.map +1 -1
  166. package/dist/commands/type.js +1 -1
  167. package/dist/commands/uname.d.ts.map +1 -1
  168. package/dist/commands/uname.js +4 -1
  169. package/dist/commands/uniq.d.ts.map +1 -1
  170. package/dist/commands/uptime.d.ts.map +1 -1
  171. package/dist/commands/uptime.js +4 -1
  172. package/dist/commands/wget.d.ts.map +1 -1
  173. package/dist/commands/wget.js +32 -7
  174. package/dist/commands/which.d.ts.map +1 -1
  175. package/dist/commands/xargs.d.ts.map +1 -1
  176. package/dist/commands/xargs.js +1 -1
  177. package/dist/index.d.ts +15 -14
  178. package/dist/index.d.ts.map +1 -1
  179. package/dist/index.js +9 -9
  180. package/dist/modules/linuxRootfs.d.ts +18 -1
  181. package/dist/modules/linuxRootfs.d.ts.map +1 -1
  182. package/dist/modules/linuxRootfs.js +160 -17
  183. package/dist/standalone-wo-sftp.d.ts +2 -0
  184. package/dist/standalone-wo-sftp.d.ts.map +1 -0
  185. package/dist/standalone-wo-sftp.js +30 -0
  186. package/dist/utils/expand.d.ts +50 -0
  187. package/dist/utils/expand.d.ts.map +1 -0
  188. package/dist/utils/expand.js +183 -0
  189. package/dist/utils/vfsDiff.d.ts +90 -0
  190. package/dist/utils/vfsDiff.d.ts.map +1 -0
  191. package/dist/utils/vfsDiff.js +177 -0
  192. package/package.json +2 -1
  193. package/src/SSHMimic/exec.ts +10 -1
  194. package/src/SSHMimic/executor.ts +104 -18
  195. package/src/SSHMimic/index.ts +49 -15
  196. package/src/VirtualFileSystem/binaryPack.ts +35 -8
  197. package/src/VirtualFileSystem/index.ts +78 -28
  198. package/src/VirtualPackageManager/index.ts +208 -49
  199. package/src/VirtualShell/index.ts +35 -7
  200. package/src/VirtualShell/shell.ts +23 -3
  201. package/src/VirtualShell/shellParser.ts +134 -36
  202. package/src/VirtualUserManager/index.ts +7 -2
  203. package/src/commands/adduser.ts +6 -0
  204. package/src/commands/alias.ts +5 -1
  205. package/src/commands/apt.ts +47 -17
  206. package/src/commands/awk.ts +20 -6
  207. package/src/commands/base64.ts +13 -2
  208. package/src/commands/cat.ts +13 -5
  209. package/src/commands/cd.ts +5 -0
  210. package/src/commands/chmod.ts +5 -0
  211. package/src/commands/cp.ts +5 -0
  212. package/src/commands/curl.ts +56 -12
  213. package/src/commands/cut.ts +8 -1
  214. package/src/commands/date.ts +7 -1
  215. package/src/commands/declare.ts +44 -0
  216. package/src/commands/diff.ts +17 -3
  217. package/src/commands/dpkg.ts +33 -11
  218. package/src/commands/du.ts +17 -5
  219. package/src/commands/echo.ts +22 -9
  220. package/src/commands/env.ts +11 -1
  221. package/src/commands/exit.ts +12 -2
  222. package/src/commands/export.ts +3 -1
  223. package/src/commands/find.ts +5 -0
  224. package/src/commands/free.ts +9 -2
  225. package/src/commands/grep.ts +12 -2
  226. package/src/commands/gzip.ts +28 -4
  227. package/src/commands/head.ts +5 -0
  228. package/src/commands/help.ts +121 -47
  229. package/src/commands/history.ts +7 -2
  230. package/src/commands/hostname.ts +5 -0
  231. package/src/commands/id.ts +4 -1
  232. package/src/commands/index.ts +9 -360
  233. package/src/commands/ls.ts +5 -3
  234. package/src/commands/lsb-release.ts +8 -2
  235. package/src/commands/nano.ts +1 -1
  236. package/src/commands/neofetch.ts +1 -1
  237. package/src/commands/node.ts +341 -0
  238. package/src/commands/npm.ts +132 -0
  239. package/src/commands/ping.ts +6 -2
  240. package/src/commands/printf.ts +112 -0
  241. package/src/commands/ps.ts +21 -9
  242. package/src/commands/python.ts +2229 -0
  243. package/src/commands/read.ts +41 -0
  244. package/src/commands/registry.ts +244 -0
  245. package/src/commands/runtime.ts +353 -0
  246. package/src/commands/sed.ts +27 -9
  247. package/src/commands/set.ts +9 -3
  248. package/src/commands/sh.ts +159 -55
  249. package/src/commands/shift.ts +53 -0
  250. package/src/commands/sleep.ts +2 -1
  251. package/src/commands/sort.ts +10 -6
  252. package/src/commands/source.ts +15 -3
  253. package/src/commands/sudo.ts +1 -1
  254. package/src/commands/tar.ts +28 -7
  255. package/src/commands/tee.ts +7 -1
  256. package/src/commands/test.ts +61 -26
  257. package/src/commands/tr.ts +3 -1
  258. package/src/commands/true.ts +17 -0
  259. package/src/commands/type.ts +6 -3
  260. package/src/commands/uname.ts +5 -1
  261. package/src/commands/uniq.ts +8 -2
  262. package/src/commands/uptime.ts +4 -1
  263. package/src/commands/wget.ts +51 -12
  264. package/src/commands/which.ts +5 -2
  265. package/src/commands/xargs.ts +11 -2
  266. package/src/index.ts +23 -24
  267. package/src/modules/linuxRootfs.ts +233 -30
  268. package/src/standalone-wo-sftp.ts +38 -0
  269. package/src/utils/expand.ts +238 -0
  270. package/src/utils/vfsDiff.ts +275 -0
  271. package/standalone-wo-sftp.js +507 -0
  272. package/standalone-wo-sftp.js.map +7 -0
  273. package/standalone.js +253 -191
  274. package/standalone.js.map +4 -4
  275. package/tests/bun-test-shim.ts +9 -1
  276. package/tests/command-helpers.test.ts +1 -5
  277. package/tests/new-features.test.ts +415 -5
  278. package/tests/parser-executor.test.ts +27 -27
  279. package/tests/sftp.test.ts +122 -42
  280. package/tests/users.test.ts +23 -5
  281. package/CHANGELOG.md +0 -150
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/VirtualUserManager/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAI3C,OAAO,KAAK,iBAAiB,MAAM,sBAAsB,CAAC;AAE1D,gDAAgD;AAChD,MAAM,WAAW,iBAAiB;IACjC,yBAAyB;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,sDAAsD;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,oDAAoD;IACpD,YAAY,EAAE,MAAM,CAAC;CACrB;AAED,2DAA2D;AAC3D,MAAM,WAAW,oBAAoB;IACpC,wCAAwC;IACxC,EAAE,EAAE,MAAM,CAAC;IACX,iCAAiC;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,GAAG,EAAE,MAAM,CAAC;IACZ,sCAAsC;IACtC,aAAa,EAAE,MAAM,CAAC;IACtB,gCAAgC;IAChC,SAAS,EAA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E;IAI5B,OAAO,CAAC,WAAW;IA4BnB,OAAO,CAAC,kBAAkB;IAgB1B,OAAO,CAAC,iBAAiB;YAwBX,OAAO;IA0CrB,OAAO,CAAC,cAAc;IAiBtB,OAAO,CAAC,YAAY;IAkBpB;;;;;;;OAOG;IACI,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAS7C;;;;;;;;OAQG;IACI,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAQ7C,OAAO,CAAC,gBAAgB;IAUxB,OAAO,CAAC,gBAAgB;IAKxB,OAAO,CAAC,QAAQ,CAAC,cAAc,CAG3B;IAEJ;;;;;;OAMG;IACI,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAQ3E;;;;OAIG;IACI,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAKnD;;;;;OAKG;IACI,iBAAiB,CACvB,QAAQ,EAAE,MAAM,GACd,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CAGxC"}
@@ -1,3 +1,9 @@
1
1
  import type { ShellModule } from "../types/commands";
2
+ /**
3
+ * Add a new user to the virtual user database.
4
+ * @category users
5
+ * @params ["<username> <password>"]
6
+ * @returns ShellModule
7
+ */
2
8
  export declare const adduserCommand: ShellModule;
3
9
  //# sourceMappingURL=adduser.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"adduser.d.ts","sourceRoot":"","sources":["../../src/commands/adduser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,eAAO,MAAM,cAAc,EAAE,WAqB5B,CAAC"}
1
+ {"version":3,"file":"adduser.d.ts","sourceRoot":"","sources":["../../src/commands/adduser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAE,WAqB5B,CAAC"}
@@ -1,3 +1,9 @@
1
+ /**
2
+ * Add a new user to the virtual user database.
3
+ * @category users
4
+ * @params ["<username> <password>"]
5
+ * @returns ShellModule
6
+ */
1
7
  export const adduserCommand = {
2
8
  name: "adduser",
3
9
  description: "Add a new user",
@@ -1,4 +1,9 @@
1
1
  import type { ShellModule } from "../types/commands";
2
+ /**
3
+ * Manage shell aliases (list / set / remove).
4
+ * @category shell
5
+ * @params ["[name[=value] ...]"]
6
+ */
2
7
  export declare const aliasCommand: ShellModule;
3
8
  export declare const unaliasCommand: ShellModule;
4
9
  //# sourceMappingURL=alias.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"alias.d.ts","sourceRoot":"","sources":["../../src/commands/alias.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,eAAO,MAAM,YAAY,EAAE,WAkC1B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,WAoB5B,CAAC"}
1
+ {"version":3,"file":"alias.d.ts","sourceRoot":"","sources":["../../src/commands/alias.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,WAkC1B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,WAoB5B,CAAC"}
@@ -1,4 +1,9 @@
1
1
  import { ifFlag } from "./command-helpers";
2
+ /**
3
+ * Manage shell aliases (list / set / remove).
4
+ * @category shell
5
+ * @params ["[name[=value] ...]"]
6
+ */
2
7
  export const aliasCommand = {
3
8
  name: "alias",
4
9
  description: "Define or display aliases",
@@ -1,4 +1,9 @@
1
1
  import type { ShellModule } from "../types/commands";
2
+ /**
3
+ * APT package manager front-end (simulated).
4
+ * @category package
5
+ * @params ["<install|remove|update|upgrade|search|show|list> [pkg...]"]
6
+ */
2
7
  export declare const aptCommand: ShellModule;
3
8
  export declare const aptCacheCommand: ShellModule;
4
9
  //# sourceMappingURL=apt.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"apt.d.ts","sourceRoot":"","sources":["../../src/commands/apt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD,eAAO,MAAM,UAAU,EAAE,WA2IxB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,WAoD7B,CAAC"}
1
+ {"version":3,"file":"apt.d.ts","sourceRoot":"","sources":["../../src/commands/apt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,WAyJxB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,WA+D7B,CAAC"}
@@ -1,10 +1,15 @@
1
- import { ifFlag, } from "./command-helpers";
1
+ import { ifFlag } from "./command-helpers";
2
2
  import { getPackageManager } from "./helpers";
3
+ /**
4
+ * APT package manager front-end (simulated).
5
+ * @category package
6
+ * @params ["<install|remove|update|upgrade|search|show|list> [pkg...]"]
7
+ */
3
8
  export const aptCommand = {
4
9
  name: "apt",
5
10
  aliases: ["apt-get"],
6
11
  description: "Package manager",
7
- category: "system",
12
+ category: "package",
8
13
  params: ["<install|remove|update|upgrade|search|show|list> [pkg...]"],
9
14
  run: ({ args, shell, authUser }) => {
10
15
  const pm = getPackageManager(shell);
@@ -87,7 +92,10 @@ export const aptCommand = {
87
92
  return { stderr: "apt: show requires a package name", exitCode: 1 };
88
93
  const info = pm.show(name);
89
94
  if (!info)
90
- return { stderr: `N: Unable to locate package ${name}`, exitCode: 100 };
95
+ return {
96
+ stderr: `N: Unable to locate package ${name}`,
97
+ exitCode: 100,
98
+ };
91
99
  return { stdout: info, exitCode: 0 };
92
100
  }
93
101
  case "list": {
@@ -95,9 +103,15 @@ export const aptCommand = {
95
103
  if (installedFlag) {
96
104
  const pkgList = pm.listInstalled();
97
105
  if (pkgList.length === 0)
98
- return { stdout: "Listing... Done\n(no packages installed)", exitCode: 0 };
106
+ return {
107
+ stdout: "Listing... Done\n(no packages installed)",
108
+ exitCode: 0,
109
+ };
99
110
  const lines = pkgList.map((p) => `${p.name}/${p.section} ${p.version} ${p.architecture} [installed]`);
100
- return { stdout: `Listing... Done\n${lines.join("\n")}`, exitCode: 0 };
111
+ return {
112
+ stdout: `Listing... Done\n${lines.join("\n")}`,
113
+ exitCode: 0,
114
+ };
101
115
  }
102
116
  // all available
103
117
  const all = pm.listAvailable();
@@ -128,12 +142,15 @@ export const aptCommand = {
128
142
  export const aptCacheCommand = {
129
143
  name: "apt-cache",
130
144
  description: "Query the package cache",
131
- category: "system",
145
+ category: "package",
132
146
  params: ["<search|show|policy> [pkg]"],
133
147
  run: ({ args, shell }) => {
134
148
  const pm = getPackageManager(shell);
135
149
  if (!pm)
136
- return { stderr: "apt-cache: package manager not initialised", exitCode: 1 };
150
+ return {
151
+ stderr: "apt-cache: package manager not initialised",
152
+ exitCode: 1,
153
+ };
137
154
  const sub = args[0]?.toLowerCase();
138
155
  const pkgName = args[1];
139
156
  switch (sub) {
@@ -161,7 +178,10 @@ export const aptCacheCommand = {
161
178
  return { stderr: "Need a package name", exitCode: 1 };
162
179
  const def = pm.findInRegistry(pkgName);
163
180
  if (!def)
164
- return { stderr: `N: Unable to locate package ${pkgName}`, exitCode: 100 };
181
+ return {
182
+ stderr: `N: Unable to locate package ${pkgName}`,
183
+ exitCode: 100,
184
+ };
165
185
  const inst = pm.isInstalled(pkgName);
166
186
  return {
167
187
  stdout: [
@@ -176,7 +196,10 @@ export const aptCacheCommand = {
176
196
  };
177
197
  }
178
198
  default:
179
- return { stderr: `apt-cache: unknown command '${sub ?? ""}'`, exitCode: 1 };
199
+ return {
200
+ stderr: `apt-cache: unknown command '${sub ?? ""}'`,
201
+ exitCode: 1,
202
+ };
180
203
  }
181
204
  },
182
205
  };
@@ -1,3 +1,14 @@
1
1
  import type { ShellModule } from "../types/commands";
2
+ /**
3
+ * Minimal `awk`-like pattern scanner (supports simple print patterns).
4
+ * @category text
5
+ * @params ["[-F <sep>] '<program>' [file]"]
6
+ *
7
+ * Supported program patterns:
8
+ * - `print $N` (e.g. `print $1`, `print $2, $3`, `print $0`)
9
+ * - `{print $N}` (e.g. `{print $1}`, `{print $2, $3}`, `{print $0}`)
10
+ *
11
+ * The field separator can be set with `-F` (default is space, which splits on any whitespace).
12
+ */
2
13
  export declare const awkCommand: ShellModule;
3
14
  //# sourceMappingURL=awk.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"awk.d.ts","sourceRoot":"","sources":["../../src/commands/awk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,eAAO,MAAM,UAAU,EAAE,WA0BxB,CAAC"}
1
+ {"version":3,"file":"awk.d.ts","sourceRoot":"","sources":["../../src/commands/awk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,UAAU,EAAE,WA6BxB,CAAC"}
@@ -1,4 +1,15 @@
1
1
  import { getFlag } from "./command-helpers";
2
+ /**
3
+ * Minimal `awk`-like pattern scanner (supports simple print patterns).
4
+ * @category text
5
+ * @params ["[-F <sep>] '<program>' [file]"]
6
+ *
7
+ * Supported program patterns:
8
+ * - `print $N` (e.g. `print $1`, `print $2, $3`, `print $0`)
9
+ * - `{print $N}` (e.g. `{print $1}`, `{print $2, $3}`, `{print $0}`)
10
+ *
11
+ * The field separator can be set with `-F` (default is space, which splits on any whitespace).
12
+ */
2
13
  export const awkCommand = {
3
14
  name: "awk",
4
15
  description: "Pattern scanning and processing language (minimal)",
@@ -17,12 +28,14 @@ export const awkCommand = {
17
28
  const lines = (stdin ?? "").split("\n").filter(Boolean);
18
29
  const out = lines.map((line) => {
19
30
  const parts = line.split(sep === " " ? /\s+/ : sep);
20
- return fields.map((f) => {
31
+ return fields
32
+ .map((f) => {
21
33
  if (f === "$0")
22
34
  return line;
23
35
  const n = parseInt(f.replace("$", ""), 10);
24
36
  return Number.isNaN(n) ? f.replace(/"/g, "") : (parts[n - 1] ?? "");
25
- }).join(sep === " " ? "\t" : sep);
37
+ })
38
+ .join(sep === " " ? "\t" : sep);
26
39
  });
27
40
  return { stdout: out.join("\n"), exitCode: 0 };
28
41
  },
@@ -1,3 +1,8 @@
1
1
  import type { ShellModule } from "../types/commands";
2
+ /**
3
+ * Encode or decode base64 data.
4
+ * @category text
5
+ * @params ["[-d] [file]"]
6
+ */
2
7
  export declare const base64Command: ShellModule;
3
8
  //# sourceMappingURL=base64.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"base64.d.ts","sourceRoot":"","sources":["../../src/commands/base64.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,eAAO,MAAM,aAAa,EAAE,WAc3B,CAAC"}
1
+ {"version":3,"file":"base64.d.ts","sourceRoot":"","sources":["../../src/commands/base64.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,WAoB3B,CAAC"}
@@ -1,4 +1,9 @@
1
1
  import { ifFlag } from "./command-helpers";
2
+ /**
3
+ * Encode or decode base64 data.
4
+ * @category text
5
+ * @params ["[-d] [file]"]
6
+ */
2
7
  export const base64Command = {
3
8
  name: "base64",
4
9
  description: "Encode/decode base64",
@@ -9,7 +14,10 @@ export const base64Command = {
9
14
  const input = stdin ?? "";
10
15
  if (decode) {
11
16
  try {
12
- return { stdout: Buffer.from(input.trim(), "base64").toString("utf8"), exitCode: 0 };
17
+ return {
18
+ stdout: Buffer.from(input.trim(), "base64").toString("utf8"),
19
+ exitCode: 0,
20
+ };
13
21
  }
14
22
  catch {
15
23
  return { stderr: "base64: invalid input", exitCode: 1 };
@@ -1,3 +1,8 @@
1
1
  import type { ShellModule } from "../types/commands";
2
+ /**
3
+ * Concatenate and print files to stdout.
4
+ * @category files
5
+ * @params ["[-n] [-b] <file...>"]
6
+ */
2
7
  export declare const catCommand: ShellModule;
3
8
  //# sourceMappingURL=cat.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cat.d.ts","sourceRoot":"","sources":["../../src/commands/cat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD,eAAO,MAAM,UAAU,EAAE,WAuCxB,CAAC"}
1
+ {"version":3,"file":"cat.d.ts","sourceRoot":"","sources":["../../src/commands/cat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,WA0CxB,CAAC"}
@@ -1,5 +1,10 @@
1
1
  import { ifFlag } from "./command-helpers";
2
2
  import { assertPathAccess, resolveReadablePath } from "./helpers";
3
+ /**
4
+ * Concatenate and print files to stdout.
5
+ * @category files
6
+ * @params ["[-n] [-b] <file...>"]
7
+ */
3
8
  export const catCommand = {
4
9
  name: "cat",
5
10
  description: "Concatenate and print files",
@@ -26,11 +31,14 @@ export const catCommand = {
26
31
  return { stdout: combined, exitCode: 0 };
27
32
  }
28
33
  let lineNum = 1;
29
- const numbered = combined.split("\n").map((line) => {
34
+ const numbered = combined
35
+ .split("\n")
36
+ .map((line) => {
30
37
  if (numberNonBlank && line.trim() === "")
31
38
  return line;
32
39
  return `${String(lineNum++).padStart(6)}\t${line}`;
33
- }).join("\n");
40
+ })
41
+ .join("\n");
34
42
  return { stdout: numbered, exitCode: 0 };
35
43
  },
36
44
  };
@@ -1,3 +1,8 @@
1
1
  import type { ShellModule } from "../types/commands";
2
+ /**
3
+ * Change current working directory.
4
+ * @category navigation
5
+ * @params ["[path]"]
6
+ */
2
7
  export declare const cdCommand: ShellModule;
3
8
  //# sourceMappingURL=cd.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cd.d.ts","sourceRoot":"","sources":["../../src/commands/cd.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,eAAO,MAAM,SAAS,EAAE,WAmBvB,CAAC"}
1
+ {"version":3,"file":"cd.d.ts","sourceRoot":"","sources":["../../src/commands/cd.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,WAmBvB,CAAC"}
@@ -1,4 +1,9 @@
1
1
  import { assertPathAccess, resolvePath } from "./helpers";
2
+ /**
3
+ * Change current working directory.
4
+ * @category navigation
5
+ * @params ["[path]"]
6
+ */
2
7
  export const cdCommand = {
3
8
  name: "cd",
4
9
  description: "Change directory",
@@ -1,3 +1,8 @@
1
1
  import type { ShellModule } from "../types/commands";
2
+ /**
3
+ * Change file permissions (octal or symbolic).
4
+ * @category files
5
+ * @params ["<mode> <file>"]
6
+ */
2
7
  export declare const chmodCommand: ShellModule;
3
8
  //# sourceMappingURL=chmod.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"chmod.d.ts","sourceRoot":"","sources":["../../src/commands/chmod.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAuCrD,eAAO,MAAM,YAAY,EAAE,WAwC1B,CAAC"}
1
+ {"version":3,"file":"chmod.d.ts","sourceRoot":"","sources":["../../src/commands/chmod.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAuCrD;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,WAwC1B,CAAC"}
@@ -38,6 +38,11 @@ function applySymbolicMode(existing, modeStr) {
38
38
  }
39
39
  return mode;
40
40
  }
41
+ /**
42
+ * Change file permissions (octal or symbolic).
43
+ * @category files
44
+ * @params ["<mode> <file>"]
45
+ */
41
46
  export const chmodCommand = {
42
47
  name: "chmod",
43
48
  description: "Change file permissions",
@@ -1,3 +1,8 @@
1
1
  import type { ShellModule } from "../types/commands";
2
+ /**
3
+ * Copy files or directories inside the virtual filesystem.
4
+ * @category files
5
+ * @params ["[-r] <source> <dest>"]
6
+ */
2
7
  export declare const cpCommand: ShellModule;
3
8
  //# sourceMappingURL=cp.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cp.d.ts","sourceRoot":"","sources":["../../src/commands/cp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD,eAAO,MAAM,SAAS,EAAE,WAyEvB,CAAC"}
1
+ {"version":3,"file":"cp.d.ts","sourceRoot":"","sources":["../../src/commands/cp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,WAyEvB,CAAC"}
@@ -1,5 +1,10 @@
1
1
  import { ifFlag } from "./command-helpers";
2
2
  import { assertPathAccess, resolvePath } from "./helpers";
3
+ /**
4
+ * Copy files or directories inside the virtual filesystem.
5
+ * @category files
6
+ * @params ["[-r] <source> <dest>"]
7
+ */
3
8
  export const cpCommand = {
4
9
  name: "cp",
5
10
  description: "Copy files or directories",
@@ -1,3 +1,8 @@
1
1
  import type { ShellModule } from "../types/commands";
2
+ /**
3
+ * HTTP client wrapper using `fetch()` semantics (virtual curl).
4
+ * @category network
5
+ * @params ["[options] <url>"]
6
+ */
2
7
  export declare const curlCommand: ShellModule;
3
8
  //# sourceMappingURL=curl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"curl.d.ts","sourceRoot":"","sources":["../../src/commands/curl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD,eAAO,MAAM,WAAW,EAAE,WAiGzB,CAAC"}
1
+ {"version":3,"file":"curl.d.ts","sourceRoot":"","sources":["../../src/commands/curl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,WAwIzB,CAAC"}
@@ -1,5 +1,10 @@
1
1
  import { ifFlag, parseArgs } from "./command-helpers";
2
2
  import { assertPathAccess, resolvePath } from "./helpers";
3
+ /**
4
+ * HTTP client wrapper using `fetch()` semantics (virtual curl).
5
+ * @category network
6
+ * @params ["[options] <url>"]
7
+ */
3
8
  export const curlCommand = {
4
9
  name: "curl",
5
10
  description: "Transfer data from or to a server (pure fetch)",
@@ -7,7 +12,18 @@ export const curlCommand = {
7
12
  params: ["[options] <url>"],
8
13
  run: async ({ authUser, cwd, args, shell }) => {
9
14
  const { flagsWithValues, positionals } = parseArgs(args, {
10
- flagsWithValue: ["-o", "--output", "-X", "--request", "-d", "--data", "-H", "--header", "-u", "--user"],
15
+ flagsWithValue: [
16
+ "-o",
17
+ "--output",
18
+ "-X",
19
+ "--request",
20
+ "-d",
21
+ "--data",
22
+ "-H",
23
+ "--header",
24
+ "-u",
25
+ "--user",
26
+ ],
11
27
  });
12
28
  if (ifFlag(args, ["--help", "-h"])) {
13
29
  return {
@@ -29,18 +45,24 @@ export const curlCommand = {
29
45
  if (!url)
30
46
  return { stderr: "curl: no URL specified", exitCode: 1 };
31
47
  const outputPath = flagsWithValues.get("-o") ?? flagsWithValues.get("--output") ?? null;
32
- const method = (flagsWithValues.get("-X") ?? flagsWithValues.get("--request") ?? "GET").toUpperCase();
48
+ const method = (flagsWithValues.get("-X") ??
49
+ flagsWithValues.get("--request") ??
50
+ "GET").toUpperCase();
33
51
  const postData = flagsWithValues.get("-d") ?? flagsWithValues.get("--data") ?? null;
34
52
  const headerRaw = flagsWithValues.get("-H") ?? flagsWithValues.get("--header") ?? null;
35
53
  const silent = ifFlag(args, ["-s", "--silent"]);
36
54
  const headOnly = ifFlag(args, ["-I", "--head"]);
37
55
  const followRedirects = ifFlag(args, ["-L", "--location"]);
38
56
  const verbose = ifFlag(args, ["-v", "--verbose"]);
39
- const extraHeaders = { "User-Agent": "curl/7.88.1" };
57
+ const extraHeaders = {
58
+ "User-Agent": "curl/7.88.1",
59
+ };
40
60
  if (headerRaw) {
41
61
  const idx = headerRaw.indexOf(":");
42
62
  if (idx !== -1)
43
- extraHeaders[headerRaw.slice(0, idx).trim()] = headerRaw.slice(idx + 1).trim();
63
+ extraHeaders[headerRaw.slice(0, idx).trim()] = headerRaw
64
+ .slice(idx + 1)
65
+ .trim();
44
66
  }
45
67
  const finalMethod = postData && method === "GET" ? "POST" : method;
46
68
  const fetchOpts = {
@@ -63,7 +85,10 @@ export const curlCommand = {
63
85
  }
64
86
  catch (err) {
65
87
  const msg = err instanceof Error ? err.message : String(err);
66
- return { stderr: `curl: (6) Could not resolve host: ${msg}`, exitCode: 6 };
88
+ return {
89
+ stderr: `curl: (6) Could not resolve host: ${msg}`,
90
+ exitCode: 6,
91
+ };
67
92
  }
68
93
  if (verbose) {
69
94
  stderrLines.push(`< HTTP/1.1 ${response.status} ${response.statusText}`);
@@ -87,7 +112,10 @@ export const curlCommand = {
87
112
  shell.writeFileAsUser(authUser, target, body);
88
113
  if (!silent)
89
114
  stderrLines.push(` % Total % Received\n100 ${body.length} 100 ${body.length}`);
90
- return { stderr: stderrLines.join("\n") || undefined, exitCode: response.ok ? 0 : 22 };
115
+ return {
116
+ stderr: stderrLines.join("\n") || undefined,
117
+ exitCode: response.ok ? 0 : 22,
118
+ };
91
119
  }
92
120
  return {
93
121
  stdout: body,
@@ -1,3 +1,8 @@
1
1
  import type { ShellModule } from "../types/commands";
2
+ /**
3
+ * Extract selected fields from each line of input.
4
+ * @category text
5
+ * @params ["-d <delim> -f <fields> [file]"]
6
+ */
2
7
  export declare const cutCommand: ShellModule;
3
8
  //# sourceMappingURL=cut.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cut.d.ts","sourceRoot":"","sources":["../../src/commands/cut.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,eAAO,MAAM,UAAU,EAAE,WAyBxB,CAAC"}
1
+ {"version":3,"file":"cut.d.ts","sourceRoot":"","sources":["../../src/commands/cut.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,WA2BxB,CAAC"}
@@ -1,4 +1,9 @@
1
1
  import { getFlag } from "./command-helpers";
2
+ /**
3
+ * Extract selected fields from each line of input.
4
+ * @category text
5
+ * @params ["-d <delim> -f <fields> [file]"]
6
+ */
2
7
  export const cutCommand = {
3
8
  name: "cut",
4
9
  description: "Remove sections from lines",
@@ -9,7 +14,9 @@ export const cutCommand = {
9
14
  const fields = getFlag(args, ["-f"]) ?? "1";
10
15
  const cols = fields.split(",").map((f) => {
11
16
  const [a, b] = f.split("-").map(Number);
12
- return b !== undefined ? { from: (a ?? 1) - 1, to: b - 1 } : { from: (a ?? 1) - 1, to: (a ?? 1) - 1 };
17
+ return b !== undefined
18
+ ? { from: (a ?? 1) - 1, to: b - 1 }
19
+ : { from: (a ?? 1) - 1, to: (a ?? 1) - 1 };
13
20
  });
14
21
  const lines = (stdin ?? "").split("\n");
15
22
  const out = lines.map((line) => {
@@ -1,3 +1,8 @@
1
1
  import type { ShellModule } from "../types/commands";
2
+ /**
3
+ * Print the current date/time or a formatted representation.
4
+ * @category system
5
+ * @params ["[+format]"]
6
+ */
2
7
  export declare const dateCommand: ShellModule;
3
8
  //# sourceMappingURL=date.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../src/commands/date.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,eAAO,MAAM,WAAW,EAAE,WAqBzB,CAAC"}
1
+ {"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../src/commands/date.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,WAsBzB,CAAC"}
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Print the current date/time or a formatted representation.
3
+ * @category system
4
+ * @params ["[+format]"]
5
+ */
1
6
  export const dateCommand = {
2
7
  name: "date",
3
8
  description: "Print current date and time",
@@ -7,7 +12,8 @@ export const dateCommand = {
7
12
  const now = new Date();
8
13
  const fmt = args[0];
9
14
  if (fmt?.startsWith("+")) {
10
- const f = fmt.slice(1)
15
+ const f = fmt
16
+ .slice(1)
11
17
  .replace("%Y", String(now.getFullYear()))
12
18
  .replace("%m", String(now.getMonth() + 1).padStart(2, "0"))
13
19
  .replace("%d", String(now.getDate()).padStart(2, "0"))
@@ -0,0 +1,3 @@
1
+ import type { ShellModule } from "../types/commands";
2
+ export declare const declareCommand: ShellModule;
3
+ //# sourceMappingURL=declare.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"declare.d.ts","sourceRoot":"","sources":["../../src/commands/declare.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,eAAO,MAAM,cAAc,EAAE,WAwC5B,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { ifFlag } from "./command-helpers";
2
+ export const declareCommand = {
3
+ name: "declare",
4
+ aliases: ["local", "typeset"],
5
+ description: "Declare variables and give them attributes",
6
+ category: "shell",
7
+ params: ["[-i] [-r] [-x] [-a] [name[=value]...]"],
8
+ run: ({ args, env }) => {
9
+ if (!env)
10
+ return { exitCode: 0 };
11
+ const integer = ifFlag(args, ["-i"]);
12
+ const _readonly = ifFlag(args, ["-r"]);
13
+ const _export_ = ifFlag(args, ["-x"]);
14
+ const printAll = args.filter((a) => !a.startsWith("-")).length === 0;
15
+ if (printAll) {
16
+ const lines = Object.entries(env.vars).map(([k, v]) => `declare -- ${k}="${v}"`);
17
+ return { stdout: lines.join("\n"), exitCode: 0 };
18
+ }
19
+ const assignments = args.filter((a) => !a.startsWith("-"));
20
+ for (const token of assignments) {
21
+ const eq = token.indexOf("=");
22
+ if (eq === -1) {
23
+ // Just declare (no value)
24
+ if (!(token in env.vars))
25
+ env.vars[token] = "";
26
+ }
27
+ else {
28
+ const name = token.slice(0, eq);
29
+ let val = token.slice(eq + 1);
30
+ if (integer) {
31
+ const n = parseInt(val, 10);
32
+ val = Number.isNaN(n) ? "0" : String(n);
33
+ }
34
+ env.vars[name] = val;
35
+ }
36
+ }
37
+ return { exitCode: 0 };
38
+ },
39
+ };
@@ -1,3 +1,8 @@
1
1
  import type { ShellModule } from "../types/commands";
2
+ /**
3
+ * Compare files line-by-line and print differing lines.
4
+ * @category text
5
+ * @params ["<file1> <file2>"]
6
+ */
2
7
  export declare const diffCommand: ShellModule;
3
8
  //# sourceMappingURL=diff.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../src/commands/diff.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,eAAO,MAAM,WAAW,EAAE,WAyBzB,CAAC"}
1
+ {"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../src/commands/diff.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,WAkCzB,CAAC"}
@@ -1,4 +1,9 @@
1
1
  import { resolvePath } from "./helpers";
2
+ /**
3
+ * Compare files line-by-line and print differing lines.
4
+ * @category text
5
+ * @params ["<file1> <file2>"]
6
+ */
2
7
  export const diffCommand = {
3
8
  name: "diff",
4
9
  description: "Compare files line by line",