typescript-virtual-container 1.2.8 → 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.
- package/.vscode/settings.json +0 -1
- package/README.md +462 -44
- package/biome.json +7 -0
- package/dist/SSHMimic/exec.d.ts.map +1 -1
- package/dist/SSHMimic/executor.d.ts.map +1 -1
- package/dist/SSHMimic/executor.js +35 -21
- package/dist/SSHMimic/index.d.ts.map +1 -1
- package/dist/SSHMimic/index.js +20 -6
- package/dist/VirtualFileSystem/binaryPack.d.ts.map +1 -1
- package/dist/VirtualFileSystem/binaryPack.js +29 -6
- package/dist/VirtualFileSystem/index.d.ts.map +1 -1
- package/dist/VirtualFileSystem/index.js +36 -13
- package/dist/VirtualPackageManager/index.d.ts +202 -0
- package/dist/VirtualPackageManager/index.d.ts.map +1 -0
- package/dist/VirtualPackageManager/index.js +825 -0
- package/dist/VirtualShell/index.d.ts +93 -12
- package/dist/VirtualShell/index.d.ts.map +1 -1
- package/dist/VirtualShell/index.js +95 -13
- package/dist/VirtualShell/shell.d.ts.map +1 -1
- package/dist/VirtualShell/shell.js +3 -1
- package/dist/VirtualShell/shellParser.d.ts.map +1 -1
- package/dist/VirtualUserManager/index.d.ts +52 -20
- package/dist/VirtualUserManager/index.d.ts.map +1 -1
- package/dist/VirtualUserManager/index.js +54 -20
- package/dist/commands/adduser.d.ts +6 -0
- package/dist/commands/adduser.d.ts.map +1 -1
- package/dist/commands/adduser.js +6 -0
- package/dist/commands/alias.d.ts +9 -0
- package/dist/commands/alias.d.ts.map +1 -0
- package/dist/commands/alias.js +63 -0
- package/dist/commands/apt.d.ts +9 -0
- package/dist/commands/apt.d.ts.map +1 -0
- package/dist/commands/apt.js +205 -0
- package/dist/commands/awk.d.ts +11 -0
- package/dist/commands/awk.d.ts.map +1 -1
- package/dist/commands/awk.js +15 -2
- package/dist/commands/base64.d.ts +5 -0
- package/dist/commands/base64.d.ts.map +1 -1
- package/dist/commands/base64.js +9 -1
- package/dist/commands/cat.d.ts +5 -0
- package/dist/commands/cat.d.ts.map +1 -1
- package/dist/commands/cat.js +35 -8
- package/dist/commands/cd.d.ts +5 -0
- package/dist/commands/cd.d.ts.map +1 -1
- package/dist/commands/cd.js +5 -0
- package/dist/commands/chmod.d.ts +5 -0
- package/dist/commands/chmod.d.ts.map +1 -1
- package/dist/commands/chmod.js +57 -3
- package/dist/commands/command-helpers.d.ts +78 -4
- package/dist/commands/command-helpers.d.ts.map +1 -1
- package/dist/commands/command-helpers.js +78 -4
- package/dist/commands/cp.d.ts +5 -0
- package/dist/commands/cp.d.ts.map +1 -1
- package/dist/commands/cp.js +5 -0
- package/dist/commands/curl.d.ts +5 -0
- package/dist/commands/curl.d.ts.map +1 -1
- package/dist/commands/curl.js +106 -26
- package/dist/commands/cut.d.ts +5 -0
- package/dist/commands/cut.d.ts.map +1 -1
- package/dist/commands/cut.js +8 -1
- package/dist/commands/date.d.ts +5 -0
- package/dist/commands/date.d.ts.map +1 -1
- package/dist/commands/date.js +7 -1
- package/dist/commands/declare.d.ts +3 -0
- package/dist/commands/declare.d.ts.map +1 -0
- package/dist/commands/declare.js +39 -0
- package/dist/commands/diff.d.ts +5 -0
- package/dist/commands/diff.d.ts.map +1 -1
- package/dist/commands/diff.js +5 -0
- package/dist/commands/dpkg.d.ts +9 -0
- package/dist/commands/dpkg.d.ts.map +1 -0
- package/dist/commands/dpkg.js +161 -0
- package/dist/commands/du.d.ts.map +1 -1
- package/dist/commands/du.js +8 -2
- package/dist/commands/echo.d.ts +5 -0
- package/dist/commands/echo.d.ts.map +1 -1
- package/dist/commands/echo.js +33 -12
- package/dist/commands/env.d.ts +5 -0
- package/dist/commands/env.d.ts.map +1 -1
- package/dist/commands/env.js +11 -1
- package/dist/commands/exit.d.ts +5 -0
- package/dist/commands/exit.d.ts.map +1 -1
- package/dist/commands/exit.js +12 -2
- package/dist/commands/export.d.ts.map +1 -1
- package/dist/commands/export.js +3 -1
- package/dist/commands/find.d.ts +5 -0
- package/dist/commands/find.d.ts.map +1 -1
- package/dist/commands/find.js +5 -0
- package/dist/commands/free.d.ts +8 -0
- package/dist/commands/free.d.ts.map +1 -0
- package/dist/commands/free.js +43 -0
- package/dist/commands/grep.d.ts +5 -0
- package/dist/commands/grep.d.ts.map +1 -1
- package/dist/commands/grep.js +12 -2
- package/dist/commands/gzip.d.ts +5 -0
- package/dist/commands/gzip.d.ts.map +1 -1
- package/dist/commands/gzip.js +18 -2
- package/dist/commands/head.d.ts +5 -0
- package/dist/commands/head.d.ts.map +1 -1
- package/dist/commands/head.js +5 -0
- package/dist/commands/help.d.ts.map +1 -1
- package/dist/commands/help.js +98 -45
- package/dist/commands/helpers.d.ts +3 -0
- package/dist/commands/helpers.d.ts.map +1 -1
- package/dist/commands/helpers.js +3 -0
- package/dist/commands/history.d.ts +8 -0
- package/dist/commands/history.d.ts.map +1 -0
- package/dist/commands/history.js +26 -0
- package/dist/commands/hostname.d.ts +5 -0
- package/dist/commands/hostname.d.ts.map +1 -1
- package/dist/commands/hostname.js +5 -0
- package/dist/commands/id.d.ts.map +1 -1
- package/dist/commands/id.js +4 -1
- package/dist/commands/index.d.ts +2 -10
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +2 -231
- package/dist/commands/ls.d.ts.map +1 -1
- package/dist/commands/ls.js +6 -3
- package/dist/commands/lsb-release.d.ts +3 -0
- package/dist/commands/lsb-release.d.ts.map +1 -0
- package/dist/commands/lsb-release.js +56 -0
- package/dist/commands/man.d.ts +3 -0
- package/dist/commands/man.d.ts.map +1 -0
- package/dist/commands/man.js +155 -0
- package/dist/commands/nano.js +1 -1
- package/dist/commands/neofetch.d.ts.map +1 -1
- package/dist/commands/neofetch.js +6 -1
- package/dist/commands/node.d.ts +9 -0
- package/dist/commands/node.d.ts.map +1 -0
- package/dist/commands/node.js +316 -0
- package/dist/commands/npm.d.ts +19 -0
- package/dist/commands/npm.d.ts.map +1 -0
- package/dist/commands/npm.js +109 -0
- package/dist/commands/ping.d.ts.map +1 -1
- package/dist/commands/ping.js +7 -2
- package/dist/commands/printf.d.ts +3 -0
- package/dist/commands/printf.d.ts.map +1 -0
- package/dist/commands/printf.js +113 -0
- package/dist/commands/ps.d.ts.map +1 -1
- package/dist/commands/ps.js +30 -6
- package/dist/commands/python.d.ts +30 -0
- package/dist/commands/python.d.ts.map +1 -0
- package/dist/commands/python.js +2058 -0
- package/dist/commands/read.d.ts +3 -0
- package/dist/commands/read.d.ts.map +1 -0
- package/dist/commands/read.js +34 -0
- package/dist/commands/registry.d.ts +8 -0
- package/dist/commands/registry.d.ts.map +1 -0
- package/dist/commands/registry.js +229 -0
- package/dist/commands/runtime.d.ts +6 -0
- package/dist/commands/runtime.d.ts.map +1 -0
- package/dist/commands/runtime.js +280 -0
- package/dist/commands/sed.d.ts.map +1 -1
- package/dist/commands/sed.js +11 -3
- package/dist/commands/set.d.ts.map +1 -1
- package/dist/commands/set.js +9 -3
- package/dist/commands/sh.d.ts.map +1 -1
- package/dist/commands/sh.js +69 -30
- package/dist/commands/shift.d.ts +5 -0
- package/dist/commands/shift.d.ts.map +1 -0
- package/dist/commands/shift.js +52 -0
- package/dist/commands/sleep.d.ts.map +1 -1
- package/dist/commands/sort.d.ts.map +1 -1
- package/dist/commands/sort.js +4 -2
- package/dist/commands/source.d.ts +3 -0
- package/dist/commands/source.d.ts.map +1 -0
- package/dist/commands/source.js +34 -0
- package/dist/commands/sudo.js +1 -1
- package/dist/commands/tar.d.ts.map +1 -1
- package/dist/commands/tar.js +11 -3
- package/dist/commands/tee.d.ts.map +1 -1
- package/dist/commands/tee.js +8 -6
- package/dist/commands/test.d.ts +3 -0
- package/dist/commands/test.d.ts.map +1 -0
- package/dist/commands/test.js +114 -0
- package/dist/commands/tr.d.ts.map +1 -1
- package/dist/commands/tr.js +3 -1
- package/dist/commands/true.d.ts +4 -0
- package/dist/commands/true.d.ts.map +1 -0
- package/dist/commands/true.js +14 -0
- package/dist/commands/type.d.ts +3 -0
- package/dist/commands/type.d.ts.map +1 -0
- package/dist/commands/type.js +34 -0
- package/dist/commands/uname.d.ts.map +1 -1
- package/dist/commands/uname.js +4 -1
- package/dist/commands/uniq.d.ts.map +1 -1
- package/dist/commands/uptime.d.ts +3 -0
- package/dist/commands/uptime.d.ts.map +1 -0
- package/dist/commands/uptime.js +43 -0
- package/dist/commands/wget.d.ts.map +1 -1
- package/dist/commands/wget.js +92 -96
- package/dist/commands/which.d.ts +3 -0
- package/dist/commands/which.d.ts.map +1 -0
- package/dist/commands/which.js +32 -0
- package/dist/commands/xargs.d.ts.map +1 -1
- package/dist/commands/xargs.js +1 -1
- package/dist/index.d.ts +15 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -8
- package/dist/modules/linuxRootfs.d.ts +41 -0
- package/dist/modules/linuxRootfs.d.ts.map +1 -0
- package/dist/modules/linuxRootfs.js +440 -0
- package/dist/modules/neofetch.d.ts.map +1 -1
- package/dist/modules/neofetch.js +1 -0
- package/dist/standalone-wo-sftp.d.ts +2 -0
- package/dist/standalone-wo-sftp.d.ts.map +1 -0
- package/dist/standalone-wo-sftp.js +30 -0
- package/dist/utils/expand.d.ts +50 -0
- package/dist/utils/expand.d.ts.map +1 -0
- package/dist/utils/expand.js +183 -0
- package/dist/utils/vfsDiff.d.ts +90 -0
- package/dist/utils/vfsDiff.d.ts.map +1 -0
- package/dist/utils/vfsDiff.js +177 -0
- package/package.json +3 -1
- package/src/SSHMimic/exec.ts +10 -1
- package/src/SSHMimic/executor.ts +105 -21
- package/src/SSHMimic/index.ts +49 -15
- package/src/VirtualFileSystem/binaryPack.ts +35 -8
- package/src/VirtualFileSystem/index.ts +78 -28
- package/src/VirtualPackageManager/index.ts +979 -0
- package/src/VirtualShell/index.ts +133 -14
- package/src/VirtualShell/shell.ts +23 -3
- package/src/VirtualShell/shellParser.ts +134 -36
- package/src/VirtualUserManager/index.ts +62 -22
- package/src/commands/adduser.ts +6 -0
- package/src/commands/alias.ts +64 -0
- package/src/commands/apt.ts +228 -0
- package/src/commands/awk.ts +20 -6
- package/src/commands/base64.ts +13 -2
- package/src/commands/cat.ts +40 -8
- package/src/commands/cd.ts +5 -0
- package/src/commands/chmod.ts +53 -3
- package/src/commands/command-helpers.ts +78 -4
- package/src/commands/cp.ts +5 -0
- package/src/commands/curl.ts +118 -33
- package/src/commands/cut.ts +8 -1
- package/src/commands/date.ts +7 -1
- package/src/commands/declare.ts +44 -0
- package/src/commands/diff.ts +17 -3
- package/src/commands/dpkg.ts +180 -0
- package/src/commands/du.ts +17 -5
- package/src/commands/echo.ts +41 -12
- package/src/commands/env.ts +11 -1
- package/src/commands/exit.ts +12 -2
- package/src/commands/export.ts +3 -1
- package/src/commands/find.ts +5 -0
- package/src/commands/free.ts +47 -0
- package/src/commands/grep.ts +12 -2
- package/src/commands/gzip.ts +28 -4
- package/src/commands/head.ts +5 -0
- package/src/commands/help.ts +121 -47
- package/src/commands/helpers.ts +8 -0
- package/src/commands/history.ts +34 -0
- package/src/commands/hostname.ts +5 -0
- package/src/commands/id.ts +4 -1
- package/src/commands/index.ts +9 -255
- package/src/commands/ls.ts +6 -3
- package/src/commands/lsb-release.ts +58 -0
- package/src/commands/man.ts +166 -0
- package/src/commands/nano.ts +1 -1
- package/src/commands/neofetch.ts +6 -1
- package/src/commands/node.ts +341 -0
- package/src/commands/npm.ts +132 -0
- package/src/commands/ping.ts +10 -3
- package/src/commands/printf.ts +112 -0
- package/src/commands/ps.ts +40 -6
- package/src/commands/python.ts +2229 -0
- package/src/commands/read.ts +41 -0
- package/src/commands/registry.ts +244 -0
- package/src/commands/runtime.ts +353 -0
- package/src/commands/sed.ts +27 -9
- package/src/commands/set.ts +9 -3
- package/src/commands/sh.ts +170 -44
- package/src/commands/shift.ts +53 -0
- package/src/commands/sleep.ts +2 -1
- package/src/commands/sort.ts +10 -6
- package/src/commands/source.ts +47 -0
- package/src/commands/sudo.ts +1 -1
- package/src/commands/tar.ts +28 -7
- package/src/commands/tee.ts +7 -1
- package/src/commands/test.ts +135 -0
- package/src/commands/tr.ts +3 -1
- package/src/commands/true.ts +17 -0
- package/src/commands/type.ts +43 -0
- package/src/commands/uname.ts +5 -1
- package/src/commands/uniq.ts +8 -2
- package/src/commands/uptime.ts +49 -0
- package/src/commands/wget.ts +105 -119
- package/src/commands/which.ts +37 -0
- package/src/commands/xargs.ts +11 -2
- package/src/index.ts +27 -18
- package/src/modules/linuxRootfs.ts +642 -0
- package/src/modules/neofetch.ts +1 -0
- package/src/standalone-wo-sftp.ts +38 -0
- package/src/utils/expand.ts +238 -0
- package/src/utils/vfsDiff.ts +275 -0
- package/standalone-wo-sftp.js +507 -0
- package/standalone-wo-sftp.js.map +7 -0
- package/standalone.js +486 -109
- package/standalone.js.map +4 -4
- package/tests/bun-test-shim.ts +9 -1
- package/tests/command-helpers.test.ts +1 -5
- package/tests/new-features.test.ts +1036 -0
- package/tests/parser-executor.test.ts +27 -27
- package/tests/sftp.test.ts +122 -42
- package/tests/users.test.ts +23 -5
- package/CHANGELOG.md +0 -150
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { ifFlag, parseArgs } from "./command-helpers";
|
|
2
|
+
import { getPackageManager } from "./helpers";
|
|
3
|
+
/**
|
|
4
|
+
* dpkg compatibility command (query/remove/list) backed by the virtual package manager.
|
|
5
|
+
* @category package
|
|
6
|
+
* @params ["[-l] [-s pkg] [-L pkg] [-i pkg] [--remove pkg]"]
|
|
7
|
+
*/
|
|
8
|
+
export const dpkgCommand = {
|
|
9
|
+
name: "dpkg",
|
|
10
|
+
description: "Debian package manager low-level tool",
|
|
11
|
+
category: "package",
|
|
12
|
+
params: ["[-l] [-s pkg] [-L pkg] [-i pkg] [--remove pkg]"],
|
|
13
|
+
run: ({ args, authUser, shell }) => {
|
|
14
|
+
const pm = getPackageManager(shell);
|
|
15
|
+
if (!pm)
|
|
16
|
+
return { stderr: "dpkg: package manager not initialised", exitCode: 1 };
|
|
17
|
+
const listFlag = ifFlag(args, ["-l", "--list"]);
|
|
18
|
+
const statusFlag = ifFlag(args, ["-s", "--status"]);
|
|
19
|
+
const listFilesFlag = ifFlag(args, ["-L", "--listfiles"]);
|
|
20
|
+
const removeFlag = ifFlag(args, ["-r", "--remove"]);
|
|
21
|
+
const purgeFlag = ifFlag(args, ["-P", "--purge"]);
|
|
22
|
+
const { positionals } = parseArgs(args, {
|
|
23
|
+
flags: [
|
|
24
|
+
"-l",
|
|
25
|
+
"--list",
|
|
26
|
+
"-s",
|
|
27
|
+
"--status",
|
|
28
|
+
"-L",
|
|
29
|
+
"--listfiles",
|
|
30
|
+
"-r",
|
|
31
|
+
"--remove",
|
|
32
|
+
"-P",
|
|
33
|
+
"--purge",
|
|
34
|
+
],
|
|
35
|
+
});
|
|
36
|
+
if (listFlag) {
|
|
37
|
+
const pkgList = pm.listInstalled();
|
|
38
|
+
if (pkgList.length === 0) {
|
|
39
|
+
return {
|
|
40
|
+
stdout: [
|
|
41
|
+
"Desired=Unknown/Install/Remove/Purge/Hold",
|
|
42
|
+
"|Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend",
|
|
43
|
+
"|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)",
|
|
44
|
+
"||/ Name Version Architecture Description",
|
|
45
|
+
"+++-==============-===============-============-========================================",
|
|
46
|
+
"(no packages installed)",
|
|
47
|
+
].join("\n"),
|
|
48
|
+
exitCode: 0,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
const header = [
|
|
52
|
+
"Desired=Unknown/Install/Remove/Purge/Hold",
|
|
53
|
+
"|Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend",
|
|
54
|
+
"|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)",
|
|
55
|
+
"||/ Name Version Architecture Description",
|
|
56
|
+
"+++-==============-===============-============-========================================",
|
|
57
|
+
];
|
|
58
|
+
const rows = pkgList.map((p) => {
|
|
59
|
+
const name = p.name.padEnd(14).slice(0, 14);
|
|
60
|
+
const ver = p.version.padEnd(15).slice(0, 15);
|
|
61
|
+
const arch = p.architecture.padEnd(12).slice(0, 12);
|
|
62
|
+
const desc = (p.description || "").slice(0, 40);
|
|
63
|
+
return `ii ${name} ${ver} ${arch} ${desc}`;
|
|
64
|
+
});
|
|
65
|
+
return { stdout: [...header, ...rows].join("\n"), exitCode: 0 };
|
|
66
|
+
}
|
|
67
|
+
if (statusFlag) {
|
|
68
|
+
const pkgName = positionals[0];
|
|
69
|
+
if (!pkgName)
|
|
70
|
+
return { stderr: "dpkg: -s needs a package name", exitCode: 1 };
|
|
71
|
+
const info = pm.show(pkgName);
|
|
72
|
+
if (!info)
|
|
73
|
+
return {
|
|
74
|
+
stderr: `dpkg-query: package '${pkgName}' is not installed and no information is available`,
|
|
75
|
+
exitCode: 1,
|
|
76
|
+
};
|
|
77
|
+
return { stdout: info, exitCode: 0 };
|
|
78
|
+
}
|
|
79
|
+
if (listFilesFlag) {
|
|
80
|
+
const pkgName = positionals[0];
|
|
81
|
+
if (!pkgName)
|
|
82
|
+
return { stderr: "dpkg: -L needs a package name", exitCode: 1 };
|
|
83
|
+
const installed = pm.listInstalled().find((p) => p.name === pkgName);
|
|
84
|
+
if (!installed)
|
|
85
|
+
return {
|
|
86
|
+
stderr: `dpkg-query: package '${pkgName}' is not installed`,
|
|
87
|
+
exitCode: 1,
|
|
88
|
+
};
|
|
89
|
+
if (installed.files.length === 0)
|
|
90
|
+
return { stdout: "/.keep", exitCode: 0 };
|
|
91
|
+
return { stdout: installed.files.join("\n"), exitCode: 0 };
|
|
92
|
+
}
|
|
93
|
+
if (removeFlag || purgeFlag) {
|
|
94
|
+
if (authUser !== "root")
|
|
95
|
+
return {
|
|
96
|
+
stderr: "dpkg: error: requested operation requires superuser privilege",
|
|
97
|
+
exitCode: 2,
|
|
98
|
+
};
|
|
99
|
+
if (positionals.length === 0)
|
|
100
|
+
return { stderr: "dpkg: error: need an action option", exitCode: 2 };
|
|
101
|
+
const { output, exitCode } = pm.remove(positionals, { purge: purgeFlag });
|
|
102
|
+
return { stdout: output || undefined, exitCode };
|
|
103
|
+
}
|
|
104
|
+
// Default: show help
|
|
105
|
+
return {
|
|
106
|
+
stdout: [
|
|
107
|
+
"Usage: dpkg [<option>...] <command>",
|
|
108
|
+
"",
|
|
109
|
+
"Commands:",
|
|
110
|
+
" -l, --list List packages matching given pattern",
|
|
111
|
+
" -s, --status <pkg>... Report status of specified package",
|
|
112
|
+
" -L, --listfiles <pkg>... List files owned by package",
|
|
113
|
+
" -r, --remove <pkg>... Remove <pkg> but leave its configuration",
|
|
114
|
+
" -P, --purge <pkg>... Remove <pkg> and its configuration",
|
|
115
|
+
].join("\n"),
|
|
116
|
+
exitCode: 0,
|
|
117
|
+
};
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
export const dpkgQueryCommand = {
|
|
121
|
+
name: "dpkg-query",
|
|
122
|
+
description: "Show information about installed packages",
|
|
123
|
+
category: "package",
|
|
124
|
+
params: ["-W [pkg] | -l [pattern]"],
|
|
125
|
+
run: ({ args, shell }) => {
|
|
126
|
+
const pm = getPackageManager(shell);
|
|
127
|
+
if (!pm)
|
|
128
|
+
return {
|
|
129
|
+
stderr: "dpkg-query: package manager not initialised",
|
|
130
|
+
exitCode: 1,
|
|
131
|
+
};
|
|
132
|
+
const listFlag = ifFlag(args, ["-l"]);
|
|
133
|
+
const showFlag = ifFlag(args, ["-W", "--show"]);
|
|
134
|
+
const { positionals } = parseArgs(args, {
|
|
135
|
+
flags: ["-l", "-W", "--show"],
|
|
136
|
+
});
|
|
137
|
+
if (listFlag || showFlag) {
|
|
138
|
+
const pkgList = pm.listInstalled();
|
|
139
|
+
const pattern = positionals[0];
|
|
140
|
+
const filtered = pattern
|
|
141
|
+
? pkgList.filter((p) => p.name.includes(pattern))
|
|
142
|
+
: pkgList;
|
|
143
|
+
if (showFlag) {
|
|
144
|
+
return {
|
|
145
|
+
stdout: filtered.map((p) => `${p.name}\t${p.version}`).join("\n"),
|
|
146
|
+
exitCode: 0,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
const rows = filtered.map((p) => {
|
|
150
|
+
const name = p.name.padEnd(14).slice(0, 14);
|
|
151
|
+
const ver = p.version.padEnd(15).slice(0, 15);
|
|
152
|
+
return `ii ${name} ${ver} amd64 ${(p.description || "").slice(0, 40)}`;
|
|
153
|
+
});
|
|
154
|
+
return {
|
|
155
|
+
stdout: rows.join("\n") || "(no packages match)",
|
|
156
|
+
exitCode: 0,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
return { stderr: "dpkg-query: need a flag (-l, -W)", exitCode: 1 };
|
|
160
|
+
},
|
|
161
|
+
};
|
|
@@ -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,
|
|
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"}
|
package/dist/commands/du.js
CHANGED
|
@@ -12,9 +12,15 @@ export const duCommand = {
|
|
|
12
12
|
const p = resolvePath(cwd, target);
|
|
13
13
|
const fmt = (b) => human ? `${(b / 1024).toFixed(1)}K` : String(Math.ceil(b / 1024));
|
|
14
14
|
if (!shell.vfs.exists(p))
|
|
15
|
-
return {
|
|
15
|
+
return {
|
|
16
|
+
stderr: `du: ${target}: No such file or directory`,
|
|
17
|
+
exitCode: 1,
|
|
18
|
+
};
|
|
16
19
|
if (summary || shell.vfs.stat(p).type === "file") {
|
|
17
|
-
return {
|
|
20
|
+
return {
|
|
21
|
+
stdout: `${fmt(shell.vfs.getUsageBytes(p))}\t${target}`,
|
|
22
|
+
exitCode: 0,
|
|
23
|
+
};
|
|
18
24
|
}
|
|
19
25
|
const lines = [];
|
|
20
26
|
const walk = (dir, rel) => {
|
package/dist/commands/echo.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import type { ShellModule } from "../types/commands";
|
|
2
|
+
/**
|
|
3
|
+
* Echo text to stdout with shell-style expansion and escape support.
|
|
4
|
+
* @category shell
|
|
5
|
+
* @params ["[-n] [-e] [text...]"]
|
|
6
|
+
*/
|
|
2
7
|
export declare const echoCommand: ShellModule;
|
|
3
8
|
//# sourceMappingURL=echo.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"echo.d.ts","sourceRoot":"","sources":["../../src/commands/echo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"echo.d.ts","sourceRoot":"","sources":["../../src/commands/echo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAuBrD;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,WA6BzB,CAAC"}
|
package/dist/commands/echo.js
CHANGED
|
@@ -1,23 +1,44 @@
|
|
|
1
1
|
import { parseArgs } from "./command-helpers";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import { expandSync } from "../utils/expand";
|
|
3
|
+
/**
|
|
4
|
+
* Expand escape sequences for `echo -e`.
|
|
5
|
+
* Handles \n \t \r \\ \a \b \f \v and \0NNN (octal).
|
|
6
|
+
*/
|
|
7
|
+
function expandEscapes(text) {
|
|
8
|
+
return text
|
|
9
|
+
.replace(/\\n/g, "\n")
|
|
10
|
+
.replace(/\\t/g, "\t")
|
|
11
|
+
.replace(/\\r/g, "\r")
|
|
12
|
+
.replace(/\\\\/g, "\\")
|
|
13
|
+
.replace(/\\a/g, "\x07")
|
|
14
|
+
.replace(/\\b/g, "\x08")
|
|
15
|
+
.replace(/\\f/g, "\x0C")
|
|
16
|
+
.replace(/\\v/g, "\x0B")
|
|
17
|
+
.replace(/\\0(\d{1,3})/g, (_, oct) => String.fromCharCode(parseInt(oct, 8)));
|
|
7
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Echo text to stdout with shell-style expansion and escape support.
|
|
21
|
+
* @category shell
|
|
22
|
+
* @params ["[-n] [-e] [text...]"]
|
|
23
|
+
*/
|
|
8
24
|
export const echoCommand = {
|
|
9
25
|
name: "echo",
|
|
10
26
|
description: "Display text",
|
|
11
27
|
category: "shell",
|
|
12
|
-
params: ["[
|
|
13
|
-
run: ({ args,
|
|
14
|
-
const { flags, positionals } = parseArgs(args, {
|
|
15
|
-
|
|
28
|
+
params: ["[-n] [-e] [text...]"],
|
|
29
|
+
run: ({ args, stdin, env }) => {
|
|
30
|
+
const { flags, positionals } = parseArgs(args, {
|
|
31
|
+
flags: ["-n", "-e", "-E"],
|
|
32
|
+
});
|
|
33
|
+
const noNewline = flags.has("-n");
|
|
34
|
+
const escapes = flags.has("-e");
|
|
16
35
|
const rawText = positionals.length > 0 ? positionals.join(" ") : (stdin ?? "");
|
|
17
|
-
|
|
18
|
-
|
|
36
|
+
// Full expansion: $? ${#VAR} $((expr)) ~ ${VAR:-def} $VAR etc.
|
|
37
|
+
// $(cmd) is already resolved upstream by runCommand before echo.run is called.
|
|
38
|
+
const expanded = expandSync(rawText, env?.vars ?? {}, env?.lastExitCode ?? 0);
|
|
39
|
+
const text = escapes ? expandEscapes(expanded) : expanded;
|
|
19
40
|
return {
|
|
20
|
-
stdout:
|
|
41
|
+
stdout: noNewline ? text : `${text}\n`,
|
|
21
42
|
exitCode: 0,
|
|
22
43
|
};
|
|
23
44
|
},
|
package/dist/commands/env.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
/** biome-ignore-all lint/style/useNamingConvention: ENV VARS */
|
|
2
2
|
import type { ShellModule } from "../types/commands";
|
|
3
|
+
/**
|
|
4
|
+
* Print environment variables for the current session.
|
|
5
|
+
* @category shell
|
|
6
|
+
* @params []
|
|
7
|
+
*/
|
|
3
8
|
export declare const envCommand: ShellModule;
|
|
4
9
|
//# sourceMappingURL=env.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/commands/env.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,eAAO,MAAM,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/commands/env.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,WAcxB,CAAC"}
|
package/dist/commands/env.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Print environment variables for the current session.
|
|
3
|
+
* @category shell
|
|
4
|
+
* @params []
|
|
5
|
+
*/
|
|
1
6
|
export const envCommand = {
|
|
2
7
|
name: "env",
|
|
3
8
|
description: "Print environment variables",
|
|
@@ -5,6 +10,11 @@ export const envCommand = {
|
|
|
5
10
|
params: [],
|
|
6
11
|
run: ({ env, authUser }) => {
|
|
7
12
|
const vars = { ...env.vars, USER: authUser, HOME: `/home/${authUser}` };
|
|
8
|
-
return {
|
|
13
|
+
return {
|
|
14
|
+
stdout: Object.entries(vars)
|
|
15
|
+
.map(([k, v]) => `${k}=${v}`)
|
|
16
|
+
.join("\n"),
|
|
17
|
+
exitCode: 0,
|
|
18
|
+
};
|
|
9
19
|
},
|
|
10
20
|
};
|
package/dist/commands/exit.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exit.d.ts","sourceRoot":"","sources":["../../src/commands/exit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,eAAO,MAAM,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"exit.d.ts","sourceRoot":"","sources":["../../src/commands/exit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,WAUzB,CAAC"}
|
package/dist/commands/exit.js
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exit the current shell session (closeSession flag).
|
|
3
|
+
* @category shell
|
|
4
|
+
* @params ["[code]"]
|
|
5
|
+
*/
|
|
1
6
|
export const exitCommand = {
|
|
2
7
|
name: "exit",
|
|
3
8
|
aliases: ["bye"],
|
|
4
|
-
|
|
5
|
-
|
|
9
|
+
description: "Exit the shell session",
|
|
10
|
+
category: "shell",
|
|
11
|
+
params: ["[code]"],
|
|
12
|
+
run: ({ args }) => ({
|
|
13
|
+
closeSession: true,
|
|
14
|
+
exitCode: parseInt(args[0] ?? "0", 10) || 0,
|
|
15
|
+
}),
|
|
6
16
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../src/commands/export.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,eAAO,MAAM,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../src/commands/export.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,eAAO,MAAM,aAAa,EAAE,WAwB3B,CAAC"}
|
package/dist/commands/export.js
CHANGED
|
@@ -5,7 +5,9 @@ export const exportCommand = {
|
|
|
5
5
|
params: ["[VAR=value]"],
|
|
6
6
|
run: ({ args, env }) => {
|
|
7
7
|
if (args.length === 0) {
|
|
8
|
-
const out = Object.entries(env.vars)
|
|
8
|
+
const out = Object.entries(env.vars)
|
|
9
|
+
.map(([k, v]) => `declare -x ${k}="${v}"`)
|
|
10
|
+
.join("\n");
|
|
9
11
|
return { stdout: out, exitCode: 0 };
|
|
10
12
|
}
|
|
11
13
|
for (const arg of args) {
|
package/dist/commands/find.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import type { ShellModule } from "../types/commands";
|
|
2
|
+
/**
|
|
3
|
+
* Find files and directories by name and type with minimal pattern support.
|
|
4
|
+
* @category files
|
|
5
|
+
* @params ["[path] [-name <pattern>] [-type f|d]"]
|
|
6
|
+
*/
|
|
2
7
|
export declare const findCommand: ShellModule;
|
|
3
8
|
//# sourceMappingURL=find.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../src/commands/find.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD,eAAO,MAAM,WAAW,EAAE,WA0DzB,CAAC"}
|
|
1
|
+
{"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../src/commands/find.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,WA0DzB,CAAC"}
|
package/dist/commands/find.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { getFlag } from "./command-helpers";
|
|
2
2
|
import { assertPathAccess, resolvePath } from "./helpers";
|
|
3
|
+
/**
|
|
4
|
+
* Find files and directories by name and type with minimal pattern support.
|
|
5
|
+
* @category files
|
|
6
|
+
* @params ["[path] [-name <pattern>] [-type f|d]"]
|
|
7
|
+
*/
|
|
3
8
|
export const findCommand = {
|
|
4
9
|
name: "find",
|
|
5
10
|
description: "Search for files",
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ShellModule } from "../types/commands";
|
|
2
|
+
/**
|
|
3
|
+
* Display memory usage information (human / MB / GB options).
|
|
4
|
+
* @category system
|
|
5
|
+
* @params ["[-h] [-m] [-g]"]
|
|
6
|
+
*/
|
|
7
|
+
export declare const freeCommand: ShellModule;
|
|
8
|
+
//# sourceMappingURL=free.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"free.d.ts","sourceRoot":"","sources":["../../src/commands/free.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,WAqCzB,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as os from "node:os";
|
|
2
|
+
import { ifFlag } from "./command-helpers";
|
|
3
|
+
/**
|
|
4
|
+
* Display memory usage information (human / MB / GB options).
|
|
5
|
+
* @category system
|
|
6
|
+
* @params ["[-h] [-m] [-g]"]
|
|
7
|
+
*/
|
|
8
|
+
export const freeCommand = {
|
|
9
|
+
name: "free",
|
|
10
|
+
description: "Display amount of free and used memory",
|
|
11
|
+
category: "system",
|
|
12
|
+
params: ["[-h] [-m] [-g]"],
|
|
13
|
+
run: ({ args }) => {
|
|
14
|
+
const human = ifFlag(args, ["-h", "--human"]);
|
|
15
|
+
const mb = ifFlag(args, ["-m"]);
|
|
16
|
+
const gb = ifFlag(args, ["-g"]);
|
|
17
|
+
const osTotalB = os.totalmem();
|
|
18
|
+
const osFreeB = os.freemem();
|
|
19
|
+
const usedB = osTotalB - osFreeB;
|
|
20
|
+
const sharedB = Math.floor(osTotalB * 0.02);
|
|
21
|
+
const buffersB = Math.floor(osTotalB * 0.05);
|
|
22
|
+
const availableB = Math.floor(osFreeB * 0.95);
|
|
23
|
+
const swapB = Math.floor(osTotalB * 0.5);
|
|
24
|
+
const fmt = (bytes) => {
|
|
25
|
+
if (human) {
|
|
26
|
+
if (bytes >= 1024 * 1024 * 1024)
|
|
27
|
+
return `${(bytes / (1024 * 1024 * 1024)).toFixed(1)}G`;
|
|
28
|
+
if (bytes >= 1024 * 1024)
|
|
29
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)}M`;
|
|
30
|
+
return `${(bytes / 1024).toFixed(1)}K`;
|
|
31
|
+
}
|
|
32
|
+
if (gb)
|
|
33
|
+
return String(Math.floor(bytes / (1024 * 1024 * 1024)));
|
|
34
|
+
if (mb)
|
|
35
|
+
return String(Math.floor(bytes / (1024 * 1024)));
|
|
36
|
+
return String(Math.floor(bytes / 1024));
|
|
37
|
+
};
|
|
38
|
+
const header = ` total used free shared buff/cache available`;
|
|
39
|
+
const memRow = `Mem: ${fmt(osTotalB).padStart(12)} ${fmt(usedB).padStart(11)} ${fmt(osFreeB).padStart(11)} ${fmt(sharedB).padStart(11)} ${fmt(buffersB).padStart(11)} ${fmt(availableB).padStart(11)}`;
|
|
40
|
+
const swapRow = `Swap: ${fmt(swapB).padStart(12)} ${fmt(0).padStart(11)} ${fmt(swapB).padStart(11)}`;
|
|
41
|
+
return { stdout: [header, memRow, swapRow].join("\n"), exitCode: 0 };
|
|
42
|
+
},
|
|
43
|
+
};
|
package/dist/commands/grep.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import type { ShellModule } from "../types/commands";
|
|
2
|
+
/**
|
|
3
|
+
* Search for a regex pattern in files or stdin with common flags.
|
|
4
|
+
* @category text
|
|
5
|
+
* @params ["[-i] [-v] [-n] [-r] <pattern> [file...]"]
|
|
6
|
+
*/
|
|
2
7
|
export declare const grepCommand: ShellModule;
|
|
3
8
|
//# sourceMappingURL=grep.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grep.d.ts","sourceRoot":"","sources":["../../src/commands/grep.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD,eAAO,MAAM,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"grep.d.ts","sourceRoot":"","sources":["../../src/commands/grep.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,WA6FzB,CAAC"}
|
package/dist/commands/grep.js
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { parseArgs } from "./command-helpers";
|
|
2
2
|
import { assertPathAccess, resolvePath } from "./helpers";
|
|
3
|
+
/**
|
|
4
|
+
* Search for a regex pattern in files or stdin with common flags.
|
|
5
|
+
* @category text
|
|
6
|
+
* @params ["[-i] [-v] [-n] [-r] <pattern> [file...]"]
|
|
7
|
+
*/
|
|
3
8
|
export const grepCommand = {
|
|
4
9
|
name: "grep",
|
|
5
10
|
description: "Search text patterns",
|
|
6
11
|
category: "text",
|
|
7
12
|
params: ["[-i] [-v] [-n] [-r] <pattern> [file...]"],
|
|
8
13
|
run: ({ authUser, shell, cwd, args, stdin }) => {
|
|
9
|
-
const { flags, positionals } = parseArgs(args, {
|
|
14
|
+
const { flags, positionals } = parseArgs(args, {
|
|
15
|
+
flags: ["-i", "-v", "-n", "-r"],
|
|
16
|
+
});
|
|
10
17
|
const caseInsensitive = flags.has("-i");
|
|
11
18
|
const invertMatch = flags.has("-v");
|
|
12
19
|
const showLineNumbers = flags.has("-n");
|
|
@@ -80,7 +87,10 @@ export const grepCommand = {
|
|
|
80
87
|
results.push(...matchLines(content, prefix));
|
|
81
88
|
}
|
|
82
89
|
catch {
|
|
83
|
-
return {
|
|
90
|
+
return {
|
|
91
|
+
stderr: `grep: ${file}: No such file or directory`,
|
|
92
|
+
exitCode: 1,
|
|
93
|
+
};
|
|
84
94
|
}
|
|
85
95
|
}
|
|
86
96
|
}
|
package/dist/commands/gzip.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import type { ShellModule } from "../types/commands";
|
|
2
|
+
/**
|
|
3
|
+
* Compress files using gzip (stores in VFS as compressed content).
|
|
4
|
+
* @category archive
|
|
5
|
+
* @params ["<file>"]
|
|
6
|
+
*/
|
|
2
7
|
export declare const gzipCommand: ShellModule;
|
|
3
8
|
export declare const gunzipCommand: ShellModule;
|
|
4
9
|
//# sourceMappingURL=gzip.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gzip.d.ts","sourceRoot":"","sources":["../../src/commands/gzip.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,eAAO,MAAM,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"gzip.d.ts","sourceRoot":"","sources":["../../src/commands/gzip.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,WAmBzB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,WAyB3B,CAAC"}
|
package/dist/commands/gzip.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { resolvePath } from "./helpers";
|
|
2
|
+
/**
|
|
3
|
+
* Compress files using gzip (stores in VFS as compressed content).
|
|
4
|
+
* @category archive
|
|
5
|
+
* @params ["<file>"]
|
|
6
|
+
*/
|
|
2
7
|
export const gzipCommand = {
|
|
3
8
|
name: "gzip",
|
|
4
9
|
description: "Compress files",
|
|
@@ -14,11 +19,19 @@ export const gzipCommand = {
|
|
|
14
19
|
return { exitCode: 0 };
|
|
15
20
|
}
|
|
16
21
|
catch {
|
|
17
|
-
return {
|
|
22
|
+
return {
|
|
23
|
+
stderr: `gzip: ${file}: No such file or directory`,
|
|
24
|
+
exitCode: 1,
|
|
25
|
+
};
|
|
18
26
|
}
|
|
19
27
|
},
|
|
20
28
|
};
|
|
21
29
|
export const gunzipCommand = {
|
|
30
|
+
/**
|
|
31
|
+
* Decompress gzip files (or zcat alias).
|
|
32
|
+
* @category archive
|
|
33
|
+
* @params ["<file>"]
|
|
34
|
+
*/
|
|
22
35
|
name: "gunzip",
|
|
23
36
|
description: "Decompress files",
|
|
24
37
|
category: "archive",
|
|
@@ -34,7 +47,10 @@ export const gunzipCommand = {
|
|
|
34
47
|
return { exitCode: 0 };
|
|
35
48
|
}
|
|
36
49
|
catch {
|
|
37
|
-
return {
|
|
50
|
+
return {
|
|
51
|
+
stderr: `gunzip: ${file}: No such file or directory`,
|
|
52
|
+
exitCode: 1,
|
|
53
|
+
};
|
|
38
54
|
}
|
|
39
55
|
},
|
|
40
56
|
};
|
package/dist/commands/head.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"head.d.ts","sourceRoot":"","sources":["../../src/commands/head.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD,eAAO,MAAM,WAAW,EAAE,WAgCzB,CAAC"}
|
|
1
|
+
{"version":3,"file":"head.d.ts","sourceRoot":"","sources":["../../src/commands/head.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,WAgCzB,CAAC"}
|
package/dist/commands/head.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { getFlag } from "./command-helpers";
|
|
2
2
|
import { assertPathAccess, resolvePath } from "./helpers";
|
|
3
|
+
/**
|
|
4
|
+
* Output the first part of files or stdin (head).
|
|
5
|
+
* @category text
|
|
6
|
+
* @params ["[-n <lines>] [file...]"]
|
|
7
|
+
*/
|
|
3
8
|
export const headCommand = {
|
|
4
9
|
name: "head",
|
|
5
10
|
description: "Output first lines",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../src/commands/help.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../src/commands/help.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AA6HrD,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,MAAM,EAAE,GAAG,WAAW,CA0BxE"}
|