typescript-virtual-container 1.3.3 → 1.4.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 (282) hide show
  1. package/.vscode/settings.json +0 -1
  2. package/README.md +674 -1504
  3. package/benchmark-results.txt +21 -21
  4. package/builds/self-standalone.js +274 -208
  5. package/builds/self-standalone.js.map +4 -4
  6. package/builds/standalone-wo-sftp.js +201 -149
  7. package/builds/standalone-wo-sftp.js.map +4 -4
  8. package/builds/standalone.js +263 -211
  9. package/builds/standalone.js.map +4 -4
  10. package/builds/web-full-api.min.js +3 -3
  11. package/builds/web-full-api.min.js.map +4 -4
  12. package/builds/web.min.js +2 -2
  13. package/builds/web.min.js.map +4 -4
  14. package/bun.lock +14 -12
  15. package/dist/SSHClient/index.d.ts.map +1 -1
  16. package/dist/SSHClient/index.js +5 -3
  17. package/dist/SSHMimic/executor.d.ts +1 -3
  18. package/dist/SSHMimic/executor.d.ts.map +1 -1
  19. package/dist/SSHMimic/executor.js +20 -22
  20. package/dist/SSHMimic/index.d.ts.map +1 -1
  21. package/dist/SSHMimic/index.js +5 -3
  22. package/dist/SSHMimic/sftp.d.ts.map +1 -1
  23. package/dist/SSHMimic/sftp.js +26 -21
  24. package/dist/VirtualShell/shell.d.ts.map +1 -1
  25. package/dist/VirtualShell/shell.js +25 -3
  26. package/dist/VirtualShell/shellParser.d.ts +1 -8
  27. package/dist/VirtualShell/shellParser.d.ts.map +1 -1
  28. package/dist/VirtualShell/shellParser.js +2 -81
  29. package/dist/VirtualUserManager/index.d.ts +7 -1
  30. package/dist/VirtualUserManager/index.d.ts.map +1 -1
  31. package/dist/VirtualUserManager/index.js +47 -19
  32. package/dist/commands/adduser.d.ts +10 -4
  33. package/dist/commands/adduser.d.ts.map +1 -1
  34. package/dist/commands/adduser.js +75 -12
  35. package/dist/commands/alias.d.ts +5 -0
  36. package/dist/commands/alias.d.ts.map +1 -1
  37. package/dist/commands/alias.js +5 -0
  38. package/dist/commands/apt.d.ts +5 -0
  39. package/dist/commands/apt.d.ts.map +1 -1
  40. package/dist/commands/apt.js +5 -0
  41. package/dist/commands/awk.d.ts +10 -8
  42. package/dist/commands/awk.d.ts.map +1 -1
  43. package/dist/commands/awk.js +156 -28
  44. package/dist/commands/cd.d.ts.map +1 -1
  45. package/dist/commands/cd.js +0 -3
  46. package/dist/commands/clear.d.ts +5 -0
  47. package/dist/commands/clear.d.ts.map +1 -1
  48. package/dist/commands/clear.js +5 -0
  49. package/dist/commands/command-helpers.d.ts.map +1 -1
  50. package/dist/commands/command-helpers.js +8 -0
  51. package/dist/commands/declare.d.ts +5 -0
  52. package/dist/commands/declare.d.ts.map +1 -1
  53. package/dist/commands/declare.js +5 -0
  54. package/dist/commands/deluser.d.ts +12 -0
  55. package/dist/commands/deluser.d.ts.map +1 -1
  56. package/dist/commands/deluser.js +72 -6
  57. package/dist/commands/df.d.ts +5 -0
  58. package/dist/commands/df.d.ts.map +1 -1
  59. package/dist/commands/df.js +5 -0
  60. package/dist/commands/du.d.ts +5 -0
  61. package/dist/commands/du.d.ts.map +1 -1
  62. package/dist/commands/du.js +5 -0
  63. package/dist/commands/export.d.ts +5 -0
  64. package/dist/commands/export.d.ts.map +1 -1
  65. package/dist/commands/export.js +5 -0
  66. package/dist/commands/grep.d.ts.map +1 -1
  67. package/dist/commands/grep.js +22 -4
  68. package/dist/commands/groups.d.ts +5 -0
  69. package/dist/commands/groups.d.ts.map +1 -1
  70. package/dist/commands/groups.js +5 -0
  71. package/dist/commands/gzip.d.ts +5 -2
  72. package/dist/commands/gzip.d.ts.map +1 -1
  73. package/dist/commands/gzip.js +48 -28
  74. package/dist/commands/head.d.ts.map +1 -1
  75. package/dist/commands/head.js +12 -3
  76. package/dist/commands/htop.d.ts +5 -0
  77. package/dist/commands/htop.d.ts.map +1 -1
  78. package/dist/commands/htop.js +5 -0
  79. package/dist/commands/kill.d.ts +5 -0
  80. package/dist/commands/kill.d.ts.map +1 -1
  81. package/dist/commands/kill.js +5 -0
  82. package/dist/commands/ln.d.ts +2 -0
  83. package/dist/commands/ln.d.ts.map +1 -1
  84. package/dist/commands/ln.js +22 -0
  85. package/dist/commands/ls.d.ts.map +1 -1
  86. package/dist/commands/ls.js +15 -0
  87. package/dist/commands/lsb-release.d.ts +5 -0
  88. package/dist/commands/lsb-release.d.ts.map +1 -1
  89. package/dist/commands/lsb-release.js +5 -0
  90. package/dist/commands/mkdir.d.ts +5 -0
  91. package/dist/commands/mkdir.d.ts.map +1 -1
  92. package/dist/commands/mkdir.js +5 -0
  93. package/dist/commands/mv.d.ts +5 -0
  94. package/dist/commands/mv.d.ts.map +1 -1
  95. package/dist/commands/mv.js +5 -0
  96. package/dist/commands/nano.d.ts +5 -0
  97. package/dist/commands/nano.d.ts.map +1 -1
  98. package/dist/commands/nano.js +5 -0
  99. package/dist/commands/neofetch.d.ts +5 -0
  100. package/dist/commands/neofetch.d.ts.map +1 -1
  101. package/dist/commands/neofetch.js +8 -5
  102. package/dist/commands/passwd.d.ts +8 -0
  103. package/dist/commands/passwd.d.ts.map +1 -1
  104. package/dist/commands/passwd.js +32 -11
  105. package/dist/commands/ping.d.ts +5 -0
  106. package/dist/commands/ping.d.ts.map +1 -1
  107. package/dist/commands/ping.js +5 -0
  108. package/dist/commands/printf.d.ts +5 -0
  109. package/dist/commands/printf.d.ts.map +1 -1
  110. package/dist/commands/printf.js +43 -12
  111. package/dist/commands/ps.d.ts +5 -0
  112. package/dist/commands/ps.d.ts.map +1 -1
  113. package/dist/commands/ps.js +5 -0
  114. package/dist/commands/read.d.ts +5 -0
  115. package/dist/commands/read.d.ts.map +1 -1
  116. package/dist/commands/read.js +5 -0
  117. package/dist/commands/registry.d.ts.map +1 -1
  118. package/dist/commands/registry.js +4 -1
  119. package/dist/commands/rm.d.ts +5 -0
  120. package/dist/commands/rm.d.ts.map +1 -1
  121. package/dist/commands/rm.js +5 -0
  122. package/dist/commands/runtime.d.ts.map +1 -1
  123. package/dist/commands/runtime.js +1 -57
  124. package/dist/commands/sed.d.ts +5 -0
  125. package/dist/commands/sed.d.ts.map +1 -1
  126. package/dist/commands/sed.js +5 -0
  127. package/dist/commands/set.d.ts +5 -6
  128. package/dist/commands/set.d.ts.map +1 -1
  129. package/dist/commands/set.js +5 -22
  130. package/dist/commands/sh.d.ts +6 -0
  131. package/dist/commands/sh.d.ts.map +1 -1
  132. package/dist/commands/sh.js +6 -0
  133. package/dist/commands/shift.d.ts +10 -0
  134. package/dist/commands/shift.d.ts.map +1 -1
  135. package/dist/commands/shift.js +10 -0
  136. package/dist/commands/sleep.d.ts +5 -0
  137. package/dist/commands/sleep.d.ts.map +1 -1
  138. package/dist/commands/sleep.js +5 -0
  139. package/dist/commands/sort.d.ts +5 -0
  140. package/dist/commands/sort.d.ts.map +1 -1
  141. package/dist/commands/sort.js +5 -0
  142. package/dist/commands/source.d.ts +5 -0
  143. package/dist/commands/source.d.ts.map +1 -1
  144. package/dist/commands/source.js +5 -0
  145. package/dist/commands/stat.d.ts +7 -0
  146. package/dist/commands/stat.d.ts.map +1 -0
  147. package/dist/commands/stat.js +56 -0
  148. package/dist/commands/su.d.ts +13 -0
  149. package/dist/commands/su.d.ts.map +1 -1
  150. package/dist/commands/su.js +45 -14
  151. package/dist/commands/sudo.d.ts.map +1 -1
  152. package/dist/commands/sudo.js +5 -0
  153. package/dist/commands/tail.d.ts +5 -0
  154. package/dist/commands/tail.d.ts.map +1 -1
  155. package/dist/commands/tail.js +15 -3
  156. package/dist/commands/tar.d.ts +5 -0
  157. package/dist/commands/tar.d.ts.map +1 -1
  158. package/dist/commands/tar.js +40 -10
  159. package/dist/commands/tee.d.ts +5 -0
  160. package/dist/commands/tee.d.ts.map +1 -1
  161. package/dist/commands/tee.js +5 -0
  162. package/dist/commands/touch.d.ts +5 -0
  163. package/dist/commands/touch.d.ts.map +1 -1
  164. package/dist/commands/touch.js +5 -0
  165. package/dist/commands/tr.d.ts.map +1 -1
  166. package/dist/commands/tr.js +45 -10
  167. package/dist/commands/tree.d.ts +5 -0
  168. package/dist/commands/tree.d.ts.map +1 -1
  169. package/dist/commands/tree.js +5 -0
  170. package/dist/commands/true.d.ts +10 -0
  171. package/dist/commands/true.d.ts.map +1 -1
  172. package/dist/commands/true.js +10 -0
  173. package/dist/commands/type.d.ts +5 -0
  174. package/dist/commands/type.d.ts.map +1 -1
  175. package/dist/commands/type.js +5 -0
  176. package/dist/commands/uname.d.ts +5 -0
  177. package/dist/commands/uname.d.ts.map +1 -1
  178. package/dist/commands/uname.js +5 -0
  179. package/dist/commands/uniq.d.ts +5 -0
  180. package/dist/commands/uniq.d.ts.map +1 -1
  181. package/dist/commands/uniq.js +5 -0
  182. package/dist/commands/unset.d.ts +5 -0
  183. package/dist/commands/unset.d.ts.map +1 -1
  184. package/dist/commands/unset.js +5 -0
  185. package/dist/commands/uptime.d.ts +5 -0
  186. package/dist/commands/uptime.d.ts.map +1 -1
  187. package/dist/commands/uptime.js +5 -0
  188. package/dist/commands/wc.d.ts +5 -0
  189. package/dist/commands/wc.d.ts.map +1 -1
  190. package/dist/commands/wc.js +5 -0
  191. package/dist/commands/wget.d.ts +5 -0
  192. package/dist/commands/wget.d.ts.map +1 -1
  193. package/dist/commands/wget.js +5 -0
  194. package/dist/commands/who.d.ts +5 -0
  195. package/dist/commands/who.d.ts.map +1 -1
  196. package/dist/commands/who.js +5 -0
  197. package/dist/commands/whoami.d.ts +5 -0
  198. package/dist/commands/whoami.d.ts.map +1 -1
  199. package/dist/commands/whoami.js +5 -0
  200. package/dist/commands/xargs.d.ts +5 -0
  201. package/dist/commands/xargs.d.ts.map +1 -1
  202. package/dist/commands/xargs.js +5 -0
  203. package/dist/self-standalone.js +254 -30
  204. package/dist/types/commands.d.ts +36 -0
  205. package/dist/types/commands.d.ts.map +1 -1
  206. package/dist/utils/tokenize.d.ts +20 -0
  207. package/dist/utils/tokenize.d.ts.map +1 -0
  208. package/dist/utils/tokenize.js +74 -0
  209. package/examples/web.min.js +2 -2
  210. package/package.json +1 -1
  211. package/src/SSHClient/index.ts +6 -3
  212. package/src/SSHMimic/executor.ts +21 -44
  213. package/src/SSHMimic/index.ts +7 -5
  214. package/src/SSHMimic/sftp.ts +28 -21
  215. package/src/VirtualShell/shell.ts +34 -4
  216. package/src/VirtualShell/shellParser.ts +2 -103
  217. package/src/VirtualUserManager/index.ts +44 -20
  218. package/src/commands/adduser.ts +86 -13
  219. package/src/commands/alias.ts +5 -0
  220. package/src/commands/apt.ts +5 -0
  221. package/src/commands/awk.ts +154 -29
  222. package/src/commands/cd.ts +0 -4
  223. package/src/commands/clear.ts +5 -0
  224. package/src/commands/command-helpers.ts +9 -0
  225. package/src/commands/declare.ts +5 -0
  226. package/src/commands/deluser.ts +84 -7
  227. package/src/commands/df.ts +5 -0
  228. package/src/commands/du.ts +5 -0
  229. package/src/commands/export.ts +5 -0
  230. package/src/commands/grep.ts +21 -8
  231. package/src/commands/groups.ts +5 -0
  232. package/src/commands/gzip.ts +54 -28
  233. package/src/commands/head.ts +14 -4
  234. package/src/commands/htop.ts +5 -0
  235. package/src/commands/kill.ts +5 -0
  236. package/src/commands/ln.ts +22 -0
  237. package/src/commands/ls.ts +17 -0
  238. package/src/commands/lsb-release.ts +5 -0
  239. package/src/commands/mkdir.ts +5 -0
  240. package/src/commands/mv.ts +5 -0
  241. package/src/commands/nano.ts +5 -0
  242. package/src/commands/neofetch.ts +8 -6
  243. package/src/commands/passwd.ts +35 -12
  244. package/src/commands/ping.ts +5 -0
  245. package/src/commands/printf.ts +30 -13
  246. package/src/commands/ps.ts +5 -0
  247. package/src/commands/read.ts +5 -0
  248. package/src/commands/registry.ts +4 -1
  249. package/src/commands/rm.ts +5 -0
  250. package/src/commands/runtime.ts +1 -61
  251. package/src/commands/sed.ts +5 -0
  252. package/src/commands/set.ts +5 -24
  253. package/src/commands/sh.ts +9 -3
  254. package/src/commands/shift.ts +10 -0
  255. package/src/commands/sleep.ts +5 -0
  256. package/src/commands/sort.ts +5 -0
  257. package/src/commands/source.ts +5 -0
  258. package/src/commands/stat.ts +61 -0
  259. package/src/commands/su.ts +54 -16
  260. package/src/commands/sudo.ts +5 -0
  261. package/src/commands/tail.ts +17 -3
  262. package/src/commands/tar.ts +38 -15
  263. package/src/commands/tee.ts +5 -0
  264. package/src/commands/touch.ts +5 -0
  265. package/src/commands/tr.ts +54 -10
  266. package/src/commands/tree.ts +5 -0
  267. package/src/commands/true.ts +10 -0
  268. package/src/commands/type.ts +5 -0
  269. package/src/commands/uname.ts +5 -0
  270. package/src/commands/uniq.ts +5 -0
  271. package/src/commands/unset.ts +5 -0
  272. package/src/commands/uptime.ts +5 -0
  273. package/src/commands/wc.ts +5 -0
  274. package/src/commands/wget.ts +5 -0
  275. package/src/commands/who.ts +5 -0
  276. package/src/commands/whoami.ts +5 -0
  277. package/src/commands/xargs.ts +5 -0
  278. package/src/self-standalone.ts +316 -33
  279. package/src/types/commands.ts +37 -0
  280. package/src/utils/tokenize.ts +78 -0
  281. package/builds/web-iife.min.js +0 -13
  282. package/builds/web-iife.min.js.map +0 -7
@@ -1,26 +1,89 @@
1
1
  /**
2
- * Add a new user to the virtual user database.
3
- * @category users
4
- * @params ["<username> <password>"]
5
- * @returns ShellModule
2
+ * Add a new user interactively.
3
+ *
4
+ * Usage: `adduser <username>`
5
+ *
6
+ * Prompts for:
7
+ * New password: ****
8
+ * Retype new password: ****
9
+ *
10
+ * Mirrors the real `adduser` behaviour — password is never passed on the
11
+ * command line. Root-only.
6
12
  */
7
13
  export const adduserCommand = {
8
14
  name: "adduser",
9
15
  description: "Add a new user",
10
16
  category: "users",
11
- params: ["<username> <password>"],
12
- run: async ({ authUser, shell, args }) => {
17
+ params: ["<username>"],
18
+ run: ({ authUser, shell, args }) => {
13
19
  if (authUser !== "root") {
14
- return { stderr: "adduser: permission denied", exitCode: 1 };
20
+ return { stderr: "adduser: permission denied\n", exitCode: 1 };
15
21
  }
16
- const [username, password] = args;
17
- if (!username || !password) {
22
+ const username = args[0];
23
+ if (!username) {
18
24
  return {
19
- stderr: "adduser: usage: adduser <username> <password>",
25
+ stderr: "Usage: adduser <username>\n",
20
26
  exitCode: 1,
21
27
  };
22
28
  }
23
- await shell.users.addUser(username, password);
24
- return { stdout: `adduser: user '${username}' created`, exitCode: 0 };
29
+ // Reject if user already exists
30
+ if (shell.users.listUsers().includes(username)) {
31
+ return {
32
+ stderr: `adduser: user '${username}' already exists\n`,
33
+ exitCode: 1,
34
+ };
35
+ }
36
+ let newPassword = "";
37
+ let step = "new";
38
+ const onPassword = async (input, sh) => {
39
+ if (step === "new") {
40
+ if (input.length < 1) {
41
+ return {
42
+ result: {
43
+ stderr: "adduser: password cannot be empty\n",
44
+ exitCode: 1,
45
+ },
46
+ };
47
+ }
48
+ newPassword = input;
49
+ step = "retype";
50
+ return { result: null, nextPrompt: "Retype new password: " };
51
+ }
52
+ // step === "retype"
53
+ if (input !== newPassword) {
54
+ return {
55
+ result: {
56
+ stderr: "adduser: passwords do not match — user not created\n",
57
+ exitCode: 1,
58
+ },
59
+ };
60
+ }
61
+ await sh.users.addUser(username, newPassword);
62
+ return {
63
+ result: {
64
+ stdout: `${[
65
+ `Adding user '${username}' ...`,
66
+ `Adding new group '${username}' (1001) ...`,
67
+ `Adding new user '${username}' (1001) with group '${username}' ...`,
68
+ `Creating home directory '/home/${username}' ...`,
69
+ `passwd: password set for '${username}'`,
70
+ `adduser: done.`,
71
+ ].join("\n")}\n`,
72
+ exitCode: 0,
73
+ },
74
+ };
75
+ };
76
+ return {
77
+ sudoChallenge: {
78
+ username,
79
+ targetUser: username,
80
+ commandLine: null,
81
+ loginShell: false,
82
+ prompt: "New password: ",
83
+ mode: "passwd",
84
+ onPassword,
85
+ },
86
+ exitCode: 0,
87
+ };
25
88
  },
26
89
  };
@@ -5,5 +5,10 @@ import type { ShellModule } from "../types/commands";
5
5
  * @params ["[name[=value] ...]"]
6
6
  */
7
7
  export declare const aliasCommand: ShellModule;
8
+ /**
9
+ * Remove shell aliases.
10
+ * @category shell
11
+ * @params ["<name...>"]
12
+ */
8
13
  export declare const unaliasCommand: ShellModule;
9
14
  //# 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;AAErD;;;;GAIG;AACH,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;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,WAoB5B,CAAC"}
@@ -40,6 +40,11 @@ export const aliasCommand = {
40
40
  return { stdout: lines.join("\n") || undefined, exitCode: 0 };
41
41
  },
42
42
  };
43
+ /**
44
+ * Remove shell aliases.
45
+ * @category shell
46
+ * @params ["<name...>"]
47
+ */
43
48
  export const unaliasCommand = {
44
49
  name: "unalias",
45
50
  description: "Remove alias definitions",
@@ -5,5 +5,10 @@ import type { ShellModule } from "../types/commands";
5
5
  * @params ["<install|remove|update|upgrade|search|show|list> [pkg...]"]
6
6
  */
7
7
  export declare const aptCommand: ShellModule;
8
+ /**
9
+ * Query the package cache and retrieve package information.
10
+ * @category package
11
+ * @params ["<search|show|policy> [pkg]"]
12
+ */
8
13
  export declare const aptCacheCommand: ShellModule;
9
14
  //# 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;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,WAyJxB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,WA+D7B,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;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,WA+D7B,CAAC"}
@@ -139,6 +139,11 @@ export const aptCommand = {
139
139
  }
140
140
  },
141
141
  };
142
+ /**
143
+ * Query the package cache and retrieve package information.
144
+ * @category package
145
+ * @params ["<search|show|policy> [pkg]"]
146
+ */
142
147
  export const aptCacheCommand = {
143
148
  name: "apt-cache",
144
149
  description: "Query the package cache",
@@ -1,14 +1,16 @@
1
1
  import type { ShellModule } from "../types/commands";
2
2
  /**
3
- * Minimal `awk`-like pattern scanner (supports simple print patterns).
4
- * @category text
5
- * @params ["[-F <sep>] '<program>' [file]"]
3
+ * Minimal awk-like pattern scanner.
6
4
  *
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).
5
+ * Supported:
6
+ * - `NR==N` pattern (line number condition)
7
+ * - `NF` (number of fields)
8
+ * - `/regex/` pattern
9
+ * - `{ print $N, $M, ... }` action
10
+ * - `{ print }` / `{ print $0 }`
11
+ * - `BEGIN { ... }` and `END { ... }` blocks (no side effects)
12
+ * - `$NF` (last field)
13
+ * - `-F sep` field separator
12
14
  */
13
15
  export declare const awkCommand: ShellModule;
14
16
  //# 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;;;;;;;;;;GAUG;AACH,eAAO,MAAM,UAAU,EAAE,WA6BxB,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;AAIrD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,UAAU,EAAE,WAuJxB,CAAC"}
@@ -1,42 +1,170 @@
1
1
  import { getFlag } from "./command-helpers";
2
+ import { resolvePath, assertPathAccess } from "./helpers";
2
3
  /**
3
- * Minimal `awk`-like pattern scanner (supports simple print patterns).
4
- * @category text
5
- * @params ["[-F <sep>] '<program>' [file]"]
4
+ * Minimal awk-like pattern scanner.
6
5
  *
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).
6
+ * Supported:
7
+ * - `NR==N` pattern (line number condition)
8
+ * - `NF` (number of fields)
9
+ * - `/regex/` pattern
10
+ * - `{ print $N, $M, ... }` action
11
+ * - `{ print }` / `{ print $0 }`
12
+ * - `BEGIN { ... }` and `END { ... }` blocks (no side effects)
13
+ * - `$NF` (last field)
14
+ * - `-F sep` field separator
12
15
  */
13
16
  export const awkCommand = {
14
17
  name: "awk",
15
- description: "Pattern scanning and processing language (minimal)",
18
+ description: "Pattern scanning and processing language",
16
19
  category: "text",
17
20
  params: ["[-F <sep>] '<program>' [file]"],
18
- run: ({ args, stdin }) => {
21
+ run: ({ authUser, args, stdin, cwd, shell }) => {
19
22
  const sep = getFlag(args, ["-F"]) ?? " ";
20
- const prog = args.find((a) => !a.startsWith("-") && a !== sep);
23
+ const nonFlagArgs = args.filter((a) => !a.startsWith("-") && a !== sep);
24
+ const prog = nonFlagArgs[0];
25
+ const fileArg = nonFlagArgs[1];
21
26
  if (!prog)
22
27
  return { stderr: "awk: no program", exitCode: 1 };
23
- // Only support print $N and {print $N} patterns
24
- const printMatch = prog.match(/^\{?\s*print\s+([^}]+)\s*\}?$/);
25
- if (!printMatch)
26
- return { stderr: `awk: unsupported program: ${prog}`, exitCode: 1 };
27
- const fields = printMatch[1].split(/\s*,\s*/).map((f) => f.trim());
28
- const lines = (stdin ?? "").split("\n").filter(Boolean);
29
- const out = lines.map((line) => {
30
- const parts = line.split(sep === " " ? /\s+/ : sep);
31
- return fields
32
- .map((f) => {
33
- if (f === "$0")
28
+ let input = stdin ?? "";
29
+ if (fileArg) {
30
+ const filePath = resolvePath(cwd, fileArg);
31
+ try {
32
+ assertPathAccess(authUser, filePath, "awk");
33
+ input = shell.vfs.readFile(filePath);
34
+ }
35
+ catch {
36
+ return { stderr: `awk: ${fileArg}: No such file or directory`, exitCode: 1 };
37
+ }
38
+ }
39
+ const lines = input.split("\n");
40
+ // Remove empty last element if input ends with \n
41
+ if (lines[lines.length - 1] === "")
42
+ lines.pop();
43
+ const clauses = [];
44
+ const progTrim = prog.trim();
45
+ // Handle single unbraced pattern (NR==2, /regex/)
46
+ if (!progTrim.startsWith("{") && !progTrim.includes("{")) {
47
+ clauses.push({ pattern: progTrim, action: "print $0" });
48
+ }
49
+ else {
50
+ // Parse "pattern { action } pattern2 { action2 }"
51
+ const clauseRe = /([^{]*)\{([^}]*)\}/g;
52
+ let m2 = clauseRe.exec(progTrim);
53
+ while (m2 !== null) {
54
+ clauses.push({ pattern: m2[1].trim(), action: m2[2].trim() });
55
+ m2 = clauseRe.exec(progTrim);
56
+ }
57
+ if (clauses.length === 0) {
58
+ clauses.push({ pattern: "", action: progTrim.replace(/[{}]/g, "").trim() });
59
+ }
60
+ }
61
+ const out = [];
62
+ // BEGIN / END
63
+ const beginClause = clauses.find((c) => c.pattern === "BEGIN");
64
+ const endClause = clauses.find((c) => c.pattern === "END");
65
+ const mainClauses = clauses.filter((c) => c.pattern !== "BEGIN" && c.pattern !== "END");
66
+ function splitFields(line) {
67
+ if (sep === " ")
68
+ return line.trim().split(/\s+/).filter(Boolean);
69
+ return line.split(sep);
70
+ }
71
+ function evalAction(action, line, nr) {
72
+ const parts = splitFields(line);
73
+ const nf = parts.length;
74
+ // Expand variables
75
+ const resolve = (expr) => {
76
+ expr = expr.trim();
77
+ if (expr === "NR")
78
+ return String(nr);
79
+ if (expr === "NF")
80
+ return String(nf);
81
+ if (expr === "$0")
34
82
  return line;
35
- const n = parseInt(f.replace("$", ""), 10);
36
- return Number.isNaN(n) ? f.replace(/"/g, "") : (parts[n - 1] ?? "");
37
- })
38
- .join(sep === " " ? "\t" : sep);
39
- });
40
- return { stdout: out.join("\n"), exitCode: 0 };
83
+ if (expr === "$NF")
84
+ return parts[nf - 1] ?? "";
85
+ if (/^\$\d+$/.test(expr))
86
+ return parts[parseInt(expr.slice(1), 10) - 1] ?? "";
87
+ // Arithmetic NR+1, NF-1
88
+ const arith = expr.replace(/\bNR\b/g, String(nr)).replace(/\bNF\b/g, String(nf));
89
+ if (/^[\d\s+\-*/()]+$/.test(arith)) {
90
+ // biome-ignore lint/security/noGlobalEval: safe arithmetic — input contains only digits and operators after variable substitution
91
+ try {
92
+ return String(Function(`"use strict"; return (${arith});`)());
93
+ }
94
+ catch { }
95
+ }
96
+ return expr.replace(/"/g, "");
97
+ };
98
+ const stmts = action.split(";").map((s) => s.trim()).filter(Boolean);
99
+ for (const stmt of stmts) {
100
+ if (stmt === "print" || stmt === "print $0") {
101
+ out.push(line);
102
+ }
103
+ else if (stmt.startsWith("print ")) {
104
+ const args2 = stmt.slice(6).split(/\s*,\s*/);
105
+ out.push(args2.map(resolve).join("\t"));
106
+ }
107
+ }
108
+ }
109
+ function matchPattern(pattern, line, nr) {
110
+ if (!pattern)
111
+ return true;
112
+ if (pattern === "1")
113
+ return true;
114
+ // NR==N or NR>N etc.
115
+ const nrCond = pattern.match(/^NR\s*([=!<>]=?|==)\s*(\d+)$/);
116
+ if (nrCond) {
117
+ const op = nrCond[1];
118
+ const val = parseInt(nrCond[2], 10);
119
+ switch (op) {
120
+ case "==": return nr === val;
121
+ case "!=": return nr !== val;
122
+ case ">": return nr > val;
123
+ case ">=": return nr >= val;
124
+ case "<": return nr < val;
125
+ case "<=": return nr <= val;
126
+ }
127
+ }
128
+ // NR%N==M
129
+ const nrMod = pattern.match(/^NR%(\d+)==(\d+)$/);
130
+ if (nrMod) {
131
+ return nr % parseInt(nrMod[1], 10) === parseInt(nrMod[2], 10);
132
+ }
133
+ // /regex/ pattern
134
+ if (pattern.startsWith("/") && pattern.endsWith("/")) {
135
+ try {
136
+ return new RegExp(pattern.slice(1, -1)).test(line);
137
+ }
138
+ catch {
139
+ return false;
140
+ }
141
+ }
142
+ // $N~/regex/
143
+ const fieldMatch = pattern.match(/^\$(\d+)~\/(.*)\/$/);
144
+ if (fieldMatch) {
145
+ const parts = splitFields(line);
146
+ const field = parts[parseInt(fieldMatch[1], 10) - 1] ?? "";
147
+ try {
148
+ return new RegExp(fieldMatch[2]).test(field);
149
+ }
150
+ catch {
151
+ return false;
152
+ }
153
+ }
154
+ return false;
155
+ }
156
+ if (beginClause)
157
+ evalAction(beginClause.action, "", 0);
158
+ for (let nr = 1; nr <= lines.length; nr++) {
159
+ const line = lines[nr - 1];
160
+ for (const clause of mainClauses) {
161
+ if (matchPattern(clause.pattern, line, nr)) {
162
+ evalAction(clause.action, line, nr);
163
+ }
164
+ }
165
+ }
166
+ if (endClause)
167
+ evalAction(endClause.action, "", lines.length + 1);
168
+ return { stdout: out.join("\n") + (out.length > 0 ? "\n" : ""), exitCode: 0 };
41
169
  },
42
170
  };
@@ -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;;;;GAIG;AACH,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,WAevB,CAAC"}
@@ -16,9 +16,6 @@ export const cdCommand = {
16
16
  if (stats.type !== "directory") {
17
17
  return { stderr: `cd: not a directory: ${target}`, exitCode: 1 };
18
18
  }
19
- if (mode === "exec") {
20
- return { exitCode: 0 };
21
- }
22
19
  return { nextCwd: target, exitCode: 0 };
23
20
  },
24
21
  };
@@ -1,3 +1,8 @@
1
1
  import type { ShellModule } from "../types/commands";
2
+ /**
3
+ * Clear the terminal screen.
4
+ * @category shell
5
+ * @params []
6
+ */
2
7
  export declare const clearCommand: ShellModule;
3
8
  //# sourceMappingURL=clear.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"clear.d.ts","sourceRoot":"","sources":["../../src/commands/clear.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,eAAO,MAAM,YAAY,EAAE,WAO1B,CAAC"}
1
+ {"version":3,"file":"clear.d.ts","sourceRoot":"","sources":["../../src/commands/clear.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,WAO1B,CAAC"}
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Clear the terminal screen.
3
+ * @category shell
4
+ * @params []
5
+ */
1
6
  export const clearCommand = {
2
7
  name: "clear",
3
8
  description: "Clear the terminal screen",
@@ -1 +1 @@
1
- {"version":3,"file":"command-helpers.d.ts","sourceRoot":"","sources":["../../src/commands/command-helpers.ts"],"names":[],"mappings":"AAAA,KAAK,eAAe,GAAG;IACtB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B,CAAC;AA+EF;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAYxE;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,OAAO,CACtB,IAAI,EAAE,MAAM,EAAE,EACd,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GACtB,MAAM,GAAG,IAAI,GAAG,SAAS,CA0B3B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,MAAM,CACrB,IAAI,EAAE,MAAM,EAAE,EACd,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,eAAoB,GAC3B,MAAM,GAAG,SAAS,CAGpB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,SAAS,CACxB,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;CAAO,GAC3D;IACF,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACnB,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,WAAW,EAAE,MAAM,EAAE,CAAC;CACtB,CAiDA"}
1
+ {"version":3,"file":"command-helpers.d.ts","sourceRoot":"","sources":["../../src/commands/command-helpers.ts"],"names":[],"mappings":"AAAA,KAAK,eAAe,GAAG;IACtB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B,CAAC;AAwFF;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAYxE;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,OAAO,CACtB,IAAI,EAAE,MAAM,EAAE,EACd,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GACtB,MAAM,GAAG,IAAI,GAAG,SAAS,CA0B3B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,MAAM,CACrB,IAAI,EAAE,MAAM,EAAE,EACd,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,eAAoB,GAC3B,MAAM,GAAG,SAAS,CAGpB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,SAAS,CACxB,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;CAAO,GAC3D;IACF,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACnB,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,WAAW,EAAE,MAAM,EAAE,CAAC;CACtB,CAiDA"}
@@ -5,10 +5,18 @@ function matchFlagToken(token, flag) {
5
5
  if (token === flag) {
6
6
  return { matched: true, inlineValue: null };
7
7
  }
8
+ // --flag=value style
8
9
  const prefix = `${flag}=`;
9
10
  if (token.startsWith(prefix)) {
10
11
  return { matched: true, inlineValue: token.slice(prefix.length) };
11
12
  }
13
+ // Short flag inline value: -f2, -d: (single char flag like -f, -d, -n)
14
+ // Only applies to single-char flags (-X), not long flags (--flag)
15
+ if (flag.length === 2 && flag.startsWith("-") && !flag.startsWith("--")) {
16
+ if (token.startsWith(flag) && token.length > flag.length) {
17
+ return { matched: true, inlineValue: token.slice(flag.length) };
18
+ }
19
+ }
12
20
  return { matched: false, inlineValue: null };
13
21
  }
14
22
  function collectPositionals(args, options = {}) {
@@ -1,3 +1,8 @@
1
1
  import type { ShellModule } from "../types/commands";
2
+ /**
3
+ * Declare variables and give them attributes (integer, readonly, export, array).
4
+ * @category shell
5
+ * @params ["[-i] [-r] [-x] [-a] [name[=value]...]"]
6
+ */
2
7
  export declare const declareCommand: ShellModule;
3
8
  //# sourceMappingURL=declare.d.ts.map
@@ -1 +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"}
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;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,WAwC5B,CAAC"}
@@ -1,4 +1,9 @@
1
1
  import { ifFlag } from "./command-helpers";
2
+ /**
3
+ * Declare variables and give them attributes (integer, readonly, export, array).
4
+ * @category shell
5
+ * @params ["[-i] [-r] [-x] [-a] [name[=value]...]"]
6
+ */
2
7
  export const declareCommand = {
3
8
  name: "declare",
4
9
  aliases: ["local", "typeset"],
@@ -1,3 +1,15 @@
1
1
  import type { ShellModule } from "../types/commands";
2
+ /**
3
+ * Delete a user. Root-only.
4
+ *
5
+ * Without `-f`: prompts for confirmation — the user must type the exact
6
+ * username to proceed.
7
+ *
8
+ * With `-f` / `--force`: deletes without confirmation.
9
+ *
10
+ * Usage:
11
+ * deluser <username>
12
+ * deluser -f <username>
13
+ */
2
14
  export declare const deluserCommand: ShellModule;
3
15
  //# sourceMappingURL=deluser.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deluser.d.ts","sourceRoot":"","sources":["../../src/commands/deluser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,eAAO,MAAM,cAAc,EAAE,WAkB5B,CAAC"}
1
+ {"version":3,"file":"deluser.d.ts","sourceRoot":"","sources":["../../src/commands/deluser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGpE;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,cAAc,EAAE,WAkF5B,CAAC"}
@@ -1,17 +1,83 @@
1
+ /**
2
+ * Delete a user. Root-only.
3
+ *
4
+ * Without `-f`: prompts for confirmation — the user must type the exact
5
+ * username to proceed.
6
+ *
7
+ * With `-f` / `--force`: deletes without confirmation.
8
+ *
9
+ * Usage:
10
+ * deluser <username>
11
+ * deluser -f <username>
12
+ */
1
13
  export const deluserCommand = {
2
14
  name: "deluser",
3
15
  description: "Delete a user",
4
16
  category: "users",
5
- params: ["<username>"],
17
+ params: ["[-f] <username>"],
6
18
  run: async ({ authUser, args, shell }) => {
7
19
  if (authUser !== "root") {
8
- return { stderr: "deluser: permission denied", exitCode: 1 };
20
+ return { stderr: "deluser: permission denied\n", exitCode: 1 };
9
21
  }
10
- const [username] = args;
22
+ const force = args.includes("-f") ||
23
+ args.includes("--force") ||
24
+ args.includes("-y");
25
+ const username = args.find((a) => !a.startsWith("-"));
11
26
  if (!username) {
12
- return { stderr: "deluser: usage: deluser <username>", exitCode: 1 };
27
+ return {
28
+ stderr: "Usage: deluser [-f] <username>\n",
29
+ exitCode: 1,
30
+ };
13
31
  }
14
- await shell.users.deleteUser(username);
15
- return { stdout: `deluser: user '${username}' deleted`, exitCode: 0 };
32
+ if (!shell.users.listUsers().includes(username)) {
33
+ return {
34
+ stderr: `deluser: user '${username}' does not exist\n`,
35
+ exitCode: 1,
36
+ };
37
+ }
38
+ if (username === "root") {
39
+ return {
40
+ stderr: "deluser: cannot remove the root account\n",
41
+ exitCode: 1,
42
+ };
43
+ }
44
+ // Force mode — delete without confirmation
45
+ if (force) {
46
+ await shell.users.deleteUser(username);
47
+ return {
48
+ stdout: `Removing user '${username}' ...\ndeluser: done.\n`,
49
+ exitCode: 0,
50
+ };
51
+ }
52
+ // Interactive confirmation
53
+ const onPassword = async (input, sh) => {
54
+ if (input.trim() !== username) {
55
+ return {
56
+ result: {
57
+ stderr: "deluser: confirmation did not match — user not deleted\n",
58
+ exitCode: 1,
59
+ },
60
+ };
61
+ }
62
+ await sh.users.deleteUser(username);
63
+ return {
64
+ result: {
65
+ stdout: `Removing user '${username}' ...\ndeluser: done.\n`,
66
+ exitCode: 0,
67
+ },
68
+ };
69
+ };
70
+ return {
71
+ sudoChallenge: {
72
+ username,
73
+ targetUser: username,
74
+ commandLine: null,
75
+ loginShell: false,
76
+ prompt: `Warning: deleting user '${username}'.\nType the username to confirm: `,
77
+ mode: "confirm",
78
+ onPassword,
79
+ },
80
+ exitCode: 0,
81
+ };
16
82
  },
17
83
  };
@@ -1,3 +1,8 @@
1
1
  import type { ShellModule } from "../types/commands";
2
+ /**
3
+ * Report filesystem disk space usage.
4
+ * @category system
5
+ * @params ["[-h]"]
6
+ */
2
7
  export declare const dfCommand: ShellModule;
3
8
  //# sourceMappingURL=df.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"df.d.ts","sourceRoot":"","sources":["../../src/commands/df.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,eAAO,MAAM,SAAS,EAAE,WAevB,CAAC"}
1
+ {"version":3,"file":"df.d.ts","sourceRoot":"","sources":["../../src/commands/df.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,WAevB,CAAC"}
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Report filesystem disk space usage.
3
+ * @category system
4
+ * @params ["[-h]"]
5
+ */
1
6
  export const dfCommand = {
2
7
  name: "df",
3
8
  description: "Report filesystem disk space usage",
@@ -1,3 +1,8 @@
1
1
  import type { ShellModule } from "../types/commands";
2
+ /**
3
+ * Estimate file and directory space usage.
4
+ * @category system
5
+ * @params ["[-h] [-s] [path]"]
6
+ */
2
7
  export declare const duCommand: ShellModule;
3
8
  //# sourceMappingURL=du.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"du.d.ts","sourceRoot":"","sources":["../../src/commands/du.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD,eAAO,MAAM,SAAS,EAAE,WA8CvB,CAAC"}
1
+ {"version":3,"file":"du.d.ts","sourceRoot":"","sources":["../../src/commands/du.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,WA8CvB,CAAC"}
@@ -1,5 +1,10 @@
1
1
  import { ifFlag } from "./command-helpers";
2
2
  import { resolvePath } from "./helpers";
3
+ /**
4
+ * Estimate file and directory space usage.
5
+ * @category system
6
+ * @params ["[-h] [-s] [path]"]
7
+ */
3
8
  export const duCommand = {
4
9
  name: "du",
5
10
  description: "Estimate file space usage",