@lifo-sh/core 0.2.0 → 0.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/dist/awk-B6L8oRkp.js +123 -0
- package/dist/{basename-C2v8jn7p.js → basename-CgA_lsvv.js} +1 -1
- package/dist/{cat-B2exoWlk.js → cat-UKg6GIpI.js} +1 -1
- package/dist/{chmod-CQS63aP7.js → chmod-DHB58pfa.js} +1 -1
- package/dist/{chown-rgGwZwu9.js → chown-D1bGwvZd.js} +1 -1
- package/dist/commands/registry.d.ts.map +1 -1
- package/dist/commands/text/awk.d.ts.map +1 -1
- package/dist/commands/text/cut.d.ts.map +1 -1
- package/dist/commands/text/diff.d.ts.map +1 -1
- package/dist/commands/text/grep.d.ts.map +1 -1
- package/dist/commands/text/head.d.ts.map +1 -1
- package/dist/commands/text/nl.d.ts.map +1 -1
- package/dist/commands/text/rev.d.ts.map +1 -1
- package/dist/commands/text/sed.d.ts.map +1 -1
- package/dist/commands/text/sort.d.ts.map +1 -1
- package/dist/commands/text/tail.d.ts.map +1 -1
- package/dist/commands/text/uniq.d.ts.map +1 -1
- package/dist/commands/text/wc.d.ts.map +1 -1
- package/dist/commands/vcs/git.d.ts +4 -0
- package/dist/commands/vcs/git.d.ts.map +1 -0
- package/dist/{cp-C8mNek36.js → cp-hsOMjGjb.js} +1 -1
- package/dist/cut-BxA2sLod.js +65 -0
- package/dist/diff-BgH1-ECz.js +150 -0
- package/dist/{dirname-BY_Gu5i2.js → dirname-BsNcj76E.js} +1 -1
- package/dist/{du-D25egSeK.js → du-Dz7i5Bf4.js} +1 -1
- package/dist/{file-BPs1dqg5.js → file-CiWscEov.js} +1 -1
- package/dist/{find-CRUAXbhO.js → find-CWXxOQ3D.js} +1 -1
- package/dist/git-mHSHRpnj.js +603 -0
- package/dist/{grep-B9pTCSNY.js → grep-BQsxs32R.js} +33 -26
- package/dist/gunzip-DF-BdBEb.js +47 -0
- package/dist/{gzip-DgE-9PzE.js → gzip-lYiTGRe_.js} +4 -5
- package/dist/head-BtcClCUM.js +53 -0
- package/dist/{index-DccAPaZF.js → index-Do_xqri5.js} +2574 -1285
- package/dist/index.d.ts +9 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +58 -45
- package/dist/kernel/index.d.ts +2 -1
- package/dist/kernel/index.d.ts.map +1 -1
- package/dist/kernel/persistence/PersistenceManager.d.ts +3 -1
- package/dist/kernel/persistence/PersistenceManager.d.ts.map +1 -1
- package/dist/kernel/persistence/backends.d.ts +22 -0
- package/dist/kernel/persistence/backends.d.ts.map +1 -0
- package/dist/kernel/persistence/index.d.ts +6 -0
- package/dist/kernel/persistence/index.d.ts.map +1 -0
- package/dist/kernel/persistence/serializer.d.ts +8 -0
- package/dist/kernel/persistence/serializer.d.ts.map +1 -1
- package/dist/kernel/storage/BlobStore.d.ts +31 -0
- package/dist/kernel/storage/BlobStore.d.ts.map +1 -0
- package/dist/kernel/storage/ContentStore.d.ts +52 -0
- package/dist/kernel/storage/ContentStore.d.ts.map +1 -0
- package/dist/kernel/storage/index.d.ts +7 -0
- package/dist/kernel/storage/index.d.ts.map +1 -0
- package/dist/kernel/vfs/VFS.d.ts +31 -3
- package/dist/kernel/vfs/VFS.d.ts.map +1 -1
- package/dist/kernel/vfs/index.d.ts +4 -1
- package/dist/kernel/vfs/index.d.ts.map +1 -1
- package/dist/kernel/vfs/providers/NativeFsProvider.d.ts +63 -0
- package/dist/kernel/vfs/providers/NativeFsProvider.d.ts.map +1 -0
- package/dist/kernel/vfs/types.d.ts +27 -0
- package/dist/kernel/vfs/types.d.ts.map +1 -1
- package/dist/{ls-BiT10kLm.js → ls-BX03h4IP.js} +1 -1
- package/dist/{mkdir-DgzJ2JLj.js → mkdir-DGGZuAyh.js} +1 -1
- package/dist/{mktemp-Sh5DWxvc.js → mktemp-C537o9DE.js} +1 -1
- package/dist/{mv-Kp6DjQ8n.js → mv-46W3dEtX.js} +1 -1
- package/dist/{nl-DBLFdpfC.js → nl-vZH6hOSG.js} +13 -10
- package/dist/node-compat/buffer.d.ts +29 -2
- package/dist/node-compat/buffer.d.ts.map +1 -1
- package/dist/node-compat/fs.d.ts +62 -0
- package/dist/node-compat/fs.d.ts.map +1 -1
- package/dist/{realpath-BOeYN6nD.js → realpath-Ubp4BElh.js} +1 -1
- package/dist/rev-Dqg_gF2D.js +39 -0
- package/dist/{rm-DA2w3xTR.js → rm-FnbVRwGK.js} +1 -1
- package/dist/{rmdir-BiGbNDOT.js → rmdir-B2a-CeUJ.js} +3 -3
- package/dist/sandbox/Sandbox.d.ts +31 -0
- package/dist/sandbox/Sandbox.d.ts.map +1 -1
- package/dist/sandbox/SandboxFs.d.ts +4 -0
- package/dist/sandbox/SandboxFs.d.ts.map +1 -1
- package/dist/sandbox/types.d.ts +19 -0
- package/dist/sandbox/types.d.ts.map +1 -1
- package/dist/sed-BHijDEOD.js +95 -0
- package/dist/{sort-CSzSGTdB.js → sort-CheGhnUV.js} +19 -14
- package/dist/{stat-D0i1gTKB.js → stat-YSBnw2tJ.js} +1 -1
- package/dist/tail-9Z1OE7L7.js +52 -0
- package/dist/{tar-DkyzTzmT.js → tar-Dc-wpdQT.js} +15 -16
- package/dist/{tee-RqoZ3qG-.js → tee-C4QkabXH.js} +1 -1
- package/dist/{touch-k2NomRzL.js → touch-BeFpZeqv.js} +1 -1
- package/dist/{tree-B_j2_PsZ.js → tree-BiBsUSQR.js} +1 -1
- package/dist/uniq-BeGU0UTU.js +54 -0
- package/dist/{unzip-FwYCTDEZ.js → unzip-SUXLk4bS.js} +18 -19
- package/dist/utils/mime.d.ts +4 -0
- package/dist/utils/mime.d.ts.map +1 -0
- package/dist/wc-BLupYdzi.js +69 -0
- package/dist/{wget-2NAABIHc.js → wget-ALEPUtGk.js} +1 -1
- package/dist/{zip--0ncHv0q.js → zip-V6SMbx7b.js} +11 -12
- package/package.json +5 -2
- package/dist/archive-nRHWNwjH.js +0 -192
- package/dist/awk-CchAsBzt.js +0 -118
- package/dist/cut-BZez9bS1.js +0 -60
- package/dist/diff-tWPvmikU.js +0 -129
- package/dist/gunzip-BYlJhPf7.js +0 -48
- package/dist/head-DzP_T5Wx.js +0 -48
- package/dist/rev-CWRUIXWp.js +0 -34
- package/dist/sed-ClWZ06zX.js +0 -90
- package/dist/tail-tcIJLQnB.js +0 -47
- package/dist/uniq-hzJnHQOm.js +0 -51
- package/dist/wc-Jp7nOops.js +0 -60
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { r as E, i as N, c as S, V as $ } from "./index-Do_xqri5.js";
|
|
2
|
+
function W(e) {
|
|
3
|
+
const o = [];
|
|
4
|
+
let t = e.trim();
|
|
5
|
+
for (; t.length > 0 && (t = t.trim(), t.length !== 0); ) {
|
|
6
|
+
let s = null, a = "";
|
|
7
|
+
if (t.startsWith("BEGIN"))
|
|
8
|
+
s = "BEGIN", t = t.slice(5).trim();
|
|
9
|
+
else if (t.startsWith("END"))
|
|
10
|
+
s = "END", t = t.slice(3).trim();
|
|
11
|
+
else if (t.startsWith("/")) {
|
|
12
|
+
const n = t.indexOf("/", 1);
|
|
13
|
+
if (n > 0) {
|
|
14
|
+
try {
|
|
15
|
+
s = new RegExp(t.slice(1, n));
|
|
16
|
+
} catch {
|
|
17
|
+
s = null;
|
|
18
|
+
}
|
|
19
|
+
t = t.slice(n + 1).trim();
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
if (t.startsWith("{")) {
|
|
23
|
+
let n = 0, l = 0;
|
|
24
|
+
for (; l < t.length; l++)
|
|
25
|
+
if (t[l] === "{") n++;
|
|
26
|
+
else if (t[l] === "}" && (n--, n === 0))
|
|
27
|
+
break;
|
|
28
|
+
a = t.slice(1, l).trim(), t = t.slice(l + 1).trim();
|
|
29
|
+
} else s === null && (a = t, t = "");
|
|
30
|
+
o.push({ pattern: s, action: a });
|
|
31
|
+
}
|
|
32
|
+
return o;
|
|
33
|
+
}
|
|
34
|
+
function m(e, o, t, s, a, n, l) {
|
|
35
|
+
const f = [], p = e.split(";").map((r) => r.trim()).filter(Boolean);
|
|
36
|
+
for (const r of p)
|
|
37
|
+
if (r === "print" || r === "print $0")
|
|
38
|
+
f.push(t);
|
|
39
|
+
else if (r.startsWith("print ")) {
|
|
40
|
+
const h = r.slice(6).trim().split(",").map((g) => g.trim()).map((g) => k(g, o, t, s, a, l));
|
|
41
|
+
f.push(h.join(" "));
|
|
42
|
+
}
|
|
43
|
+
return f.join(`
|
|
44
|
+
`);
|
|
45
|
+
}
|
|
46
|
+
function k(e, o, t, s, a, n) {
|
|
47
|
+
if (e = e.trim(), e.startsWith('"') && e.endsWith('"'))
|
|
48
|
+
return e.slice(1, -1).replace(/\\n/g, `
|
|
49
|
+
`).replace(/\\t/g, " ");
|
|
50
|
+
if (e.startsWith("$")) {
|
|
51
|
+
const l = e.slice(1);
|
|
52
|
+
if (l === "NF")
|
|
53
|
+
return o[a - 1] || "";
|
|
54
|
+
const f = parseInt(l, 10);
|
|
55
|
+
return f === 0 ? t : o[f - 1] || "";
|
|
56
|
+
}
|
|
57
|
+
return e === "NR" ? String(s) : e === "NF" ? String(a) : n.has(e) ? n.get(e) : e;
|
|
58
|
+
}
|
|
59
|
+
const B = async (e) => {
|
|
60
|
+
let o = /\s+/, t = " ", s = "";
|
|
61
|
+
const a = [];
|
|
62
|
+
for (let r = 0; r < e.args.length; r++) {
|
|
63
|
+
const i = e.args[r];
|
|
64
|
+
i === "-F" && r + 1 < e.args.length ? (t = e.args[++r], o = new RegExp(t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"))) : i.startsWith("-F") && i.length > 2 ? (t = i.slice(2), o = new RegExp(t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"))) : s ? a.push(i) : s = i;
|
|
65
|
+
}
|
|
66
|
+
if (!s)
|
|
67
|
+
return e.stderr.write(`awk: missing program
|
|
68
|
+
`), 1;
|
|
69
|
+
let n = "";
|
|
70
|
+
if (a.length === 0)
|
|
71
|
+
if (e.stdin)
|
|
72
|
+
n = await e.stdin.readAll();
|
|
73
|
+
else
|
|
74
|
+
return e.stderr.write(`awk: missing file operand
|
|
75
|
+
`), 1;
|
|
76
|
+
else
|
|
77
|
+
for (const r of a) {
|
|
78
|
+
const i = E(e.cwd, r);
|
|
79
|
+
try {
|
|
80
|
+
if (e.vfs.stat(i), N(S(i))) {
|
|
81
|
+
e.stderr.write(`awk: ${r}: binary file, skipping
|
|
82
|
+
`);
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
n += e.vfs.readFileString(i);
|
|
86
|
+
} catch (c) {
|
|
87
|
+
if (c instanceof $)
|
|
88
|
+
return e.stderr.write(`awk: ${r}: ${c.message}
|
|
89
|
+
`), 1;
|
|
90
|
+
throw c;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
const l = W(s), f = n.replace(/\n$/, "").split(`
|
|
94
|
+
`), p = /* @__PURE__ */ new Map();
|
|
95
|
+
for (const r of l)
|
|
96
|
+
if (r.pattern === "BEGIN") {
|
|
97
|
+
const i = m(r.action, [], "", 0, 0, t, p);
|
|
98
|
+
i && e.stdout.write(i + `
|
|
99
|
+
`);
|
|
100
|
+
}
|
|
101
|
+
for (let r = 0; r < f.length; r++) {
|
|
102
|
+
const i = f[r], c = i.split(o).filter((u) => u !== ""), h = r + 1, g = c.length;
|
|
103
|
+
for (const u of l) {
|
|
104
|
+
if (u.pattern === "BEGIN" || u.pattern === "END") continue;
|
|
105
|
+
let d = !0;
|
|
106
|
+
if (u.pattern instanceof RegExp && (d = u.pattern.test(i)), d) {
|
|
107
|
+
const w = m(u.action, c, i, h, g, t, p);
|
|
108
|
+
w && e.stdout.write(w + `
|
|
109
|
+
`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
for (const r of l)
|
|
114
|
+
if (r.pattern === "END") {
|
|
115
|
+
const i = m(r.action, [], "", f.length, 0, t, p);
|
|
116
|
+
i && e.stdout.write(i + `
|
|
117
|
+
`);
|
|
118
|
+
}
|
|
119
|
+
return 0;
|
|
120
|
+
};
|
|
121
|
+
export {
|
|
122
|
+
B as default
|
|
123
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/commands/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAA8B;IAC9C,OAAO,CAAC,IAAI,CAA0D;IAEtE,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI;IAI9C,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC,GAAG,IAAI;IAIvE,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC;IAezD,IAAI,IAAI,MAAM,EAAE;CAIjB;AAED,wBAAgB,qBAAqB,IAAI,eAAe,
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/commands/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAA8B;IAC9C,OAAO,CAAC,IAAI,CAA0D;IAEtE,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI;IAI9C,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC,GAAG,IAAI;IAIvE,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC;IAezD,IAAI,IAAI,MAAM,EAAE;CAIjB;AAED,wBAAgB,qBAAqB,IAAI,eAAe,CAuFvD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"awk.d.ts","sourceRoot":"","sources":["../../../src/commands/text/awk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"awk.d.ts","sourceRoot":"","sources":["../../../src/commands/text/awk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AA8G3C,QAAA,MAAM,OAAO,EAAE,OAiGd,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cut.d.ts","sourceRoot":"","sources":["../../../src/commands/text/cut.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"cut.d.ts","sourceRoot":"","sources":["../../../src/commands/text/cut.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAuB3C,QAAA,MAAM,OAAO,EAAE,OAkEd,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../../src/commands/text/diff.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../../src/commands/text/diff.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAqO3C,QAAA,MAAM,OAAO,EAAE,OAkFd,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grep.d.ts","sourceRoot":"","sources":["../../../src/commands/text/grep.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"grep.d.ts","sourceRoot":"","sources":["../../../src/commands/text/grep.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAK3C,QAAA,MAAM,OAAO,EAAE,OAkKd,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"head.d.ts","sourceRoot":"","sources":["../../../src/commands/text/head.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"head.d.ts","sourceRoot":"","sources":["../../../src/commands/text/head.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAK3C,QAAA,MAAM,OAAO,EAAE,OA4Dd,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nl.d.ts","sourceRoot":"","sources":["../../../src/commands/text/nl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"nl.d.ts","sourceRoot":"","sources":["../../../src/commands/text/nl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAW3C,QAAA,MAAM,OAAO,EAAE,OA4Dd,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rev.d.ts","sourceRoot":"","sources":["../../../src/commands/text/rev.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"rev.d.ts","sourceRoot":"","sources":["../../../src/commands/text/rev.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAS3C,QAAA,MAAM,OAAO,EAAE,OAkCd,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sed.d.ts","sourceRoot":"","sources":["../../../src/commands/text/sed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"sed.d.ts","sourceRoot":"","sources":["../../../src/commands/text/sed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAgE3C,QAAA,MAAM,OAAO,EAAE,OA+Fd,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sort.d.ts","sourceRoot":"","sources":["../../../src/commands/text/sort.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"sort.d.ts","sourceRoot":"","sources":["../../../src/commands/text/sort.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAK3C,QAAA,MAAM,OAAO,EAAE,OAgFd,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tail.d.ts","sourceRoot":"","sources":["../../../src/commands/text/tail.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"tail.d.ts","sourceRoot":"","sources":["../../../src/commands/text/tail.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAK3C,QAAA,MAAM,OAAO,EAAE,OAuDd,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uniq.d.ts","sourceRoot":"","sources":["../../../src/commands/text/uniq.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"uniq.d.ts","sourceRoot":"","sources":["../../../src/commands/text/uniq.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAK3C,QAAA,MAAM,OAAO,EAAE,OAqEd,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wc.d.ts","sourceRoot":"","sources":["../../../src/commands/text/wc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"wc.d.ts","sourceRoot":"","sources":["../../../src/commands/text/wc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAK3C,QAAA,MAAM,OAAO,EAAE,OAgGd,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../../src/commands/vcs/git.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAkB,MAAM,aAAa,CAAC;AAu0B3D,QAAA,MAAM,UAAU,EAAE,OA2CjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { r as d, i as c, c as u, V as g } from "./index-Do_xqri5.js";
|
|
2
|
+
function h(e) {
|
|
3
|
+
const i = [];
|
|
4
|
+
for (const r of e.split(",")) {
|
|
5
|
+
const n = r.split("-");
|
|
6
|
+
if (n.length === 2) {
|
|
7
|
+
const a = parseInt(n[0], 10), o = parseInt(n[1], 10);
|
|
8
|
+
if (!isNaN(a) && !isNaN(o))
|
|
9
|
+
for (let l = a; l <= o; l++) i.push(l);
|
|
10
|
+
} else {
|
|
11
|
+
const a = parseInt(r, 10);
|
|
12
|
+
isNaN(a) || i.push(a);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return i;
|
|
16
|
+
}
|
|
17
|
+
const w = async (e) => {
|
|
18
|
+
let i = " ", r = "";
|
|
19
|
+
const n = [];
|
|
20
|
+
for (let s = 0; s < e.args.length; s++) {
|
|
21
|
+
const t = e.args[s];
|
|
22
|
+
t === "-d" && s + 1 < e.args.length ? i = e.args[++s] : t === "-f" && s + 1 < e.args.length ? r = e.args[++s] : t.startsWith("-d") && t.length > 2 ? i = t.slice(2) : t.startsWith("-f") && t.length > 2 ? r = t.slice(2) : n.push(t);
|
|
23
|
+
}
|
|
24
|
+
if (!r)
|
|
25
|
+
return e.stderr.write(`cut: you must specify a list of fields
|
|
26
|
+
`), 1;
|
|
27
|
+
const a = h(r);
|
|
28
|
+
function o(s) {
|
|
29
|
+
const t = s.split(i);
|
|
30
|
+
return a.map((f) => t[f - 1] || "").join(i);
|
|
31
|
+
}
|
|
32
|
+
let l = "";
|
|
33
|
+
if (n.length === 0)
|
|
34
|
+
if (e.stdin)
|
|
35
|
+
l = await e.stdin.readAll();
|
|
36
|
+
else
|
|
37
|
+
return e.stderr.write(`cut: missing file operand
|
|
38
|
+
`), 1;
|
|
39
|
+
else
|
|
40
|
+
for (const s of n) {
|
|
41
|
+
const t = d(e.cwd, s);
|
|
42
|
+
try {
|
|
43
|
+
if (e.vfs.stat(t), c(u(t))) {
|
|
44
|
+
e.stderr.write(`cut: ${s}: binary file, skipping
|
|
45
|
+
`);
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
l += e.vfs.readFileString(t);
|
|
49
|
+
} catch (f) {
|
|
50
|
+
if (f instanceof g)
|
|
51
|
+
return e.stderr.write(`cut: ${s}: ${f.message}
|
|
52
|
+
`), 1;
|
|
53
|
+
throw f;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const p = l.replace(/\n$/, "").split(`
|
|
57
|
+
`);
|
|
58
|
+
for (const s of p)
|
|
59
|
+
e.stdout.write(o(s) + `
|
|
60
|
+
`);
|
|
61
|
+
return 0;
|
|
62
|
+
};
|
|
63
|
+
export {
|
|
64
|
+
w as default
|
|
65
|
+
};
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { p as k } from "./args-CG6b9cZt.js";
|
|
2
|
+
import { r as g, i as m, c as C, V as y } from "./index-Do_xqri5.js";
|
|
3
|
+
const S = {
|
|
4
|
+
unified: { type: "boolean", short: "u" }
|
|
5
|
+
};
|
|
6
|
+
function L(n, f) {
|
|
7
|
+
const d = n.length, s = f.length, i = Array.from({ length: d + 1 }, () => new Array(s + 1).fill(0));
|
|
8
|
+
for (let e = 1; e <= d; e++)
|
|
9
|
+
for (let o = 1; o <= s; o++)
|
|
10
|
+
n[e - 1] === f[o - 1] ? i[e][o] = i[e - 1][o - 1] + 1 : i[e][o] = Math.max(i[e - 1][o], i[e][o - 1]);
|
|
11
|
+
const h = [];
|
|
12
|
+
let l = d, r = s;
|
|
13
|
+
for (; l > 0 || r > 0; )
|
|
14
|
+
l > 0 && r > 0 && n[l - 1] === f[r - 1] ? (h.push({ type: "keep", oldLine: n[l - 1] }), l--, r--) : r > 0 && (l === 0 || i[l][r - 1] >= i[l - 1][r]) ? (h.push({ type: "insert", newLine: f[r - 1] }), r--) : (h.push({ type: "delete", oldLine: n[l - 1] }), l--);
|
|
15
|
+
return h.reverse();
|
|
16
|
+
}
|
|
17
|
+
function j(n) {
|
|
18
|
+
const f = [];
|
|
19
|
+
let d = 0, s = 0, i = 0;
|
|
20
|
+
for (; i < n.length; ) {
|
|
21
|
+
if (n[i].type === "keep") {
|
|
22
|
+
d++, s++, i++;
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
const l = d, r = s, e = [], o = [];
|
|
26
|
+
for (; i < n.length && n[i].type !== "keep"; )
|
|
27
|
+
n[i].type === "delete" ? (e.push(n[i].oldLine), d++) : (o.push(n[i].newLine), s++), i++;
|
|
28
|
+
const c = e.length === 1 ? `${l + 1}` : e.length > 0 ? `${l + 1},${l + e.length}` : `${l}`, t = o.length === 1 ? `${r + 1}` : o.length > 0 ? `${r + 1},${r + o.length}` : `${r}`;
|
|
29
|
+
if (e.length > 0 && o.length > 0) {
|
|
30
|
+
f.push(`${c}c${t}`);
|
|
31
|
+
for (const p of e) f.push(`< ${p}`);
|
|
32
|
+
f.push("---");
|
|
33
|
+
for (const p of o) f.push(`> ${p}`);
|
|
34
|
+
} else if (e.length > 0) {
|
|
35
|
+
f.push(`${c}d${t}`);
|
|
36
|
+
for (const p of e) f.push(`< ${p}`);
|
|
37
|
+
} else {
|
|
38
|
+
f.push(`${c}a${t}`);
|
|
39
|
+
for (const p of o) f.push(`> ${p}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return f.length > 0 ? f.join(`
|
|
43
|
+
`) + `
|
|
44
|
+
` : "";
|
|
45
|
+
}
|
|
46
|
+
function v(n, f, d) {
|
|
47
|
+
if (n.every((t) => t.type === "keep")) return "";
|
|
48
|
+
const s = [];
|
|
49
|
+
let i = 0, h = 0;
|
|
50
|
+
for (const t of n)
|
|
51
|
+
t.type === "keep" ? (s.push({ type: "keep", line: t.oldLine, oldIdx: i, newIdx: h }), i++, h++) : t.type === "delete" ? (s.push({ type: "delete", line: t.oldLine, oldIdx: i, newIdx: h }), i++) : (s.push({ type: "insert", line: t.newLine, oldIdx: i, newIdx: h }), h++);
|
|
52
|
+
const l = 3, r = [];
|
|
53
|
+
let e = null, o = -1 / 0;
|
|
54
|
+
for (let t = 0; t < s.length; t++) {
|
|
55
|
+
const p = s[t];
|
|
56
|
+
if (p.type !== "keep") {
|
|
57
|
+
if (!e || t - o > l * 2 + 1) {
|
|
58
|
+
if (e) {
|
|
59
|
+
for (let a = o + 1; a < Math.min(o + 1 + l, s.length); a++)
|
|
60
|
+
s[a].type === "keep" && (e.lines.push(` ${s[a].line}`), e.oldCount++, e.newCount++);
|
|
61
|
+
r.push(e);
|
|
62
|
+
}
|
|
63
|
+
const $ = Math.max(0, t - l);
|
|
64
|
+
let u = 0, w = 0;
|
|
65
|
+
for (let a = 0; a < $; a++)
|
|
66
|
+
s[a].type !== "insert" && u++, s[a].type !== "delete" && w++;
|
|
67
|
+
e = {
|
|
68
|
+
oldStart: u + 1,
|
|
69
|
+
newStart: w + 1,
|
|
70
|
+
oldCount: 0,
|
|
71
|
+
newCount: 0,
|
|
72
|
+
lines: []
|
|
73
|
+
};
|
|
74
|
+
for (let a = $; a < t; a++)
|
|
75
|
+
s[a].type === "keep" && (e.lines.push(` ${s[a].line}`), e.oldCount++, e.newCount++);
|
|
76
|
+
} else if (t - o > 1)
|
|
77
|
+
for (let $ = o + 1; $ < t; $++)
|
|
78
|
+
s[$].type === "keep" && (e.lines.push(` ${s[$].line}`), e.oldCount++, e.newCount++);
|
|
79
|
+
p.type === "delete" ? (e.lines.push(`-${p.line}`), e.oldCount++) : (e.lines.push(`+${p.line}`), e.newCount++), o = t;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (e) {
|
|
83
|
+
for (let t = o + 1; t < Math.min(o + 1 + l, s.length); t++)
|
|
84
|
+
s[t].type === "keep" && (e.lines.push(` ${s[t].line}`), e.oldCount++, e.newCount++);
|
|
85
|
+
r.push(e);
|
|
86
|
+
}
|
|
87
|
+
const c = [];
|
|
88
|
+
c.push(`--- ${f}`), c.push(`+++ ${d}`);
|
|
89
|
+
for (const t of r)
|
|
90
|
+
c.push(`@@ -${t.oldStart},${t.oldCount} +${t.newStart},${t.newCount} @@`), c.push(...t.lines);
|
|
91
|
+
return c.join(`
|
|
92
|
+
`) + `
|
|
93
|
+
`;
|
|
94
|
+
}
|
|
95
|
+
const A = async (n) => {
|
|
96
|
+
const { flags: f, positional: d } = k(n.args, S);
|
|
97
|
+
if (d.length < 2)
|
|
98
|
+
return n.stderr.write(`diff: missing operand
|
|
99
|
+
`), 2;
|
|
100
|
+
const s = d[0], i = d[1];
|
|
101
|
+
let h, l;
|
|
102
|
+
const r = g(n.cwd, s), e = g(n.cwd, i), o = m(C(r)), c = m(C(e));
|
|
103
|
+
if (o || c) {
|
|
104
|
+
try {
|
|
105
|
+
n.vfs.stat(r);
|
|
106
|
+
} catch (u) {
|
|
107
|
+
if (u instanceof y)
|
|
108
|
+
return n.stderr.write(`diff: ${s}: ${u.message}
|
|
109
|
+
`), 2;
|
|
110
|
+
throw u;
|
|
111
|
+
}
|
|
112
|
+
try {
|
|
113
|
+
n.vfs.stat(e);
|
|
114
|
+
} catch (u) {
|
|
115
|
+
if (u instanceof y)
|
|
116
|
+
return n.stderr.write(`diff: ${i}: ${u.message}
|
|
117
|
+
`), 2;
|
|
118
|
+
throw u;
|
|
119
|
+
}
|
|
120
|
+
return n.stdout.write(`Binary files ${s} and ${i} differ
|
|
121
|
+
`), 2;
|
|
122
|
+
}
|
|
123
|
+
try {
|
|
124
|
+
h = n.vfs.readFileString(g(n.cwd, s));
|
|
125
|
+
} catch (u) {
|
|
126
|
+
if (u instanceof y)
|
|
127
|
+
return n.stderr.write(`diff: ${s}: ${u.message}
|
|
128
|
+
`), 2;
|
|
129
|
+
throw u;
|
|
130
|
+
}
|
|
131
|
+
try {
|
|
132
|
+
l = n.vfs.readFileString(g(n.cwd, i));
|
|
133
|
+
} catch (u) {
|
|
134
|
+
if (u instanceof y)
|
|
135
|
+
return n.stderr.write(`diff: ${i}: ${u.message}
|
|
136
|
+
`), 2;
|
|
137
|
+
throw u;
|
|
138
|
+
}
|
|
139
|
+
if (h === l)
|
|
140
|
+
return 0;
|
|
141
|
+
const t = h.split(`
|
|
142
|
+
`), p = l.split(`
|
|
143
|
+
`);
|
|
144
|
+
t.length > 0 && t[t.length - 1] === "" && t.pop(), p.length > 0 && p[p.length - 1] === "" && p.pop();
|
|
145
|
+
const $ = L(t, p);
|
|
146
|
+
return f.unified ? n.stdout.write(v($, s, i)) : n.stdout.write(j($)), 1;
|
|
147
|
+
};
|
|
148
|
+
export {
|
|
149
|
+
A as default
|
|
150
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as y, V as g } from "./index-
|
|
1
|
+
import { r as y, V as g } from "./index-Do_xqri5.js";
|
|
2
2
|
function u(t) {
|
|
3
3
|
return t < 1024 ? t + "B" : t < 1024 * 1024 ? (t / 1024).toFixed(1) + "K" : t < 1024 * 1024 * 1024 ? (t / (1024 * 1024)).toFixed(1) + "M" : (t / (1024 * 1024 * 1024)).toFixed(1) + "G";
|
|
4
4
|
}
|