@poe-platform/safe-bash 0.1.788 → 0.1.789
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/README.md +1 -1
- package/dist/safe-bash/chunks/{chunk-WHURJBET.js → chunk-2MUJ7RLZ.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-PYTLIUST.js → chunk-CTUHLNJM.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-Z3HX3ZBA.js → chunk-D4PHJK4T.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-O6356Z27.js → chunk-H7MMJS26.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-Q3E6C3DX.js → chunk-KHJGUF2W.js} +14 -0
- package/dist/safe-bash/chunks/{chunk-FJZNUUOQ.js → chunk-VUVKC6HV.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-ZMYVCRAF.js → chunk-X5ZCECM6.js} +2 -2
- package/dist/safe-bash/chunks/{git-UFNPAOYZ.js → git-HO7WDPHZ.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-PFBJR2PY.js → chunk-2KRKKW5S.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-4DSJDVBM.js → chunk-32F3RBUW.js} +10 -749
- package/dist/safe-bash/command-chunks/{chunk-L3MLMXL4.js → chunk-3ZK5F23O.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-4QX6XCDD.js → chunk-4RNIZ3RT.js} +79 -0
- package/dist/safe-bash/command-chunks/{chunk-D7TADAYG.js → chunk-64LG3EVJ.js} +17 -0
- package/dist/safe-bash/command-chunks/{chunk-JUDOV5MJ.js → chunk-6F7QJMJ3.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-IJ3FXP4Q.js → chunk-A3ZX6SCY.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-YNT4ZJHW.js → chunk-AT6ZSOE6.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-KSIGF4AG.js → chunk-BK4CMEE6.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-XGMWWUHV.js → chunk-CZ5DAK4K.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-Z57TV6TC.js → chunk-EZ2DTOLI.js} +4 -2
- package/dist/safe-bash/command-chunks/{chunk-ADCGH6A7.js → chunk-FH3D75FC.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-WYJTWJZ5.js → chunk-G3G6W5ZE.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-3HDIDEUJ.js → chunk-GF54KE2M.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-Z7TYZG3A.js → chunk-IHHTTQX6.js} +5 -3
- package/dist/safe-bash/command-chunks/{chunk-INDIFLBW.js → chunk-JTAGNROA.js} +4 -0
- package/dist/safe-bash/command-chunks/chunk-PGEYORBZ.js +25 -0
- package/dist/safe-bash/command-chunks/chunk-QM4UZF3C.js +753 -0
- package/dist/safe-bash/command-chunks/{chunk-TOSM3T3A.js → chunk-UJOO6DKY.js} +20 -9
- package/dist/safe-bash/command-chunks/{chunk-2LP3VMPA.js → chunk-WFDW4XXD.js} +1 -17
- package/dist/safe-bash/command-chunks/chunk-WR37IS4O.js +318 -0
- package/dist/safe-bash/command-chunks/{chunk-Y5IHIAY3.js → chunk-XNHSCU6I.js} +7 -3
- package/dist/safe-bash/commands/basic.js +148 -48
- package/dist/safe-bash/commands/bytes/compression/index.js +5 -6
- package/dist/safe-bash/commands/cmp.d.ts +2 -3
- package/dist/safe-bash/commands/cmp.js +2 -689
- package/dist/safe-bash/commands/docx/index.browser.js +3 -46
- package/dist/safe-bash/commands/docx/index.d.ts +2 -24
- package/dist/safe-bash/commands/docx/index.js +2 -41
- package/dist/safe-bash/commands/docx/io.d.ts +1 -14
- package/dist/safe-bash/commands/docx/io.js +1 -15
- package/dist/safe-bash/commands/llm/index.browser.js +3 -3
- package/dist/safe-bash/commands/network/index.browser.js +3 -3
- package/dist/safe-bash/commands/node/index.browser.js +3 -3
- package/dist/safe-bash/commands/pptx/index.d.ts +2 -28
- package/dist/safe-bash/commands/pptx/index.js +2 -152
- package/dist/safe-bash/commands/printf-float.d.ts +1 -0
- package/dist/safe-bash/commands/printf-float.js +48 -38
- package/dist/safe-bash/commands/printf-format.js +9 -6
- package/dist/safe-bash/commands/printf-quote.d.ts +3 -0
- package/dist/safe-bash/commands/printf-quote.js +62 -0
- package/dist/safe-bash/commands/printf-wide.d.ts +5 -0
- package/dist/safe-bash/commands/printf-wide.js +41 -0
- package/dist/safe-bash/commands/python/index.browser.js +2 -2
- package/dist/safe-bash/commands/truncate.d.ts +2 -3
- package/dist/safe-bash/commands/truncate.js +2 -686
- package/dist/safe-bash/contracts/diagnostics.d.ts +2 -0
- package/dist/safe-bash/contracts/diagnostics.js +2 -0
- package/dist/safe-bash/contracts/runtime-control.d.ts +2 -0
- package/dist/safe-bash/contracts/runtime-control.js +2 -0
- package/dist/safe-bash/core.browser.d.ts +1 -1
- package/dist/safe-bash/core.browser.js +2651 -4871
- package/dist/safe-bash/core.d.ts +10 -0
- package/dist/safe-bash/opt-in/commands/cmp/index.d.ts +6 -2
- package/dist/safe-bash/opt-in/commands/cmp/index.js +776 -79
- package/dist/safe-bash/opt-in/commands/cmp/options.d.ts +0 -12
- package/dist/safe-bash/opt-in/commands/cmp/options.js +0 -153
- package/dist/safe-bash/opt-in/commands/truncate/index.d.ts +8 -3
- package/dist/safe-bash/opt-in/commands/truncate/index.js +790 -272
- package/dist/safe-bash/opt-in/commands/truncate/sync.d.ts +1 -0
- package/dist/safe-bash/opt-in/commands/truncate/sync.js +60 -0
- package/dist/safe-bash/optional-host.browser.js +9 -1
- package/dist/safe-bash/optional-host.d.ts +3 -1
- package/dist/safe-bash/optional-host.js +3 -1
- package/dist/safe-bash/shell/runtime.js +10 -6
- package/dist/safe-bash-checksum-engine/index.d.ts +1 -1
- package/dist/safe-bash-checksum-engine/index.js +14 -2
- package/dist/safe-bash-command-bzip2/index.js +2 -1
- package/dist/safe-bash-command-cmp/index.d.ts +10 -0
- package/dist/safe-bash-command-cmp/index.js +796 -0
- package/dist/safe-bash-command-cmp/options.d.ts +12 -0
- package/dist/safe-bash-command-cmp/options.js +42 -0
- package/dist/safe-bash-command-csvcut/index.js +11 -8
- package/dist/safe-bash-command-csvgrep/index.js +35 -7
- package/dist/safe-bash-command-csvkit/codecs/python.js +4 -3
- package/dist/safe-bash-command-csvkit/codecs/utf8.js +3 -2
- package/dist/safe-bash-command-csvkit/index.js +80 -324
- package/dist/safe-bash-command-csvkit/python-regex.d.ts +5 -0
- package/dist/safe-bash-command-csvkit/python-regex.js +14 -0
- package/dist/safe-bash-command-csvkit/runtime.d.ts +1 -0
- package/dist/safe-bash-command-csvkit/sync-support.js +4 -2
- package/dist/safe-bash-command-diff3/index.js +3 -0
- package/dist/safe-bash-command-docx/LICENSE +21 -0
- package/dist/safe-bash-command-docx/index.d.ts +30 -0
- package/dist/safe-bash-command-docx/index.js +67 -0
- package/dist/safe-bash-command-docx/io.d.ts +14 -0
- package/dist/safe-bash-command-docx/io.js +26 -0
- package/dist/safe-bash-command-envsubst/index.js +34 -3
- package/dist/safe-bash-command-exiftool/index.js +3 -0
- package/dist/safe-bash-command-ffmpeg/index.js +1102 -1088
- package/dist/safe-bash-command-fold/family.js +1 -1
- package/dist/safe-bash-command-fold/index.js +1 -1
- package/dist/safe-bash-command-htmlq/index.js +5 -0
- package/dist/safe-bash-command-imagemagick/index.d.ts +25 -21
- package/dist/safe-bash-command-imagemagick/index.js +669 -271
- package/dist/safe-bash-command-mmdc/index.js +48 -10
- package/dist/safe-bash-command-mmdc/svg.d.ts +1 -0
- package/dist/safe-bash-command-op/index.js +19 -14
- package/dist/safe-bash-command-pandoc/command.js +1 -1
- package/dist/safe-bash-command-pandoc/index.js +1 -1
- package/dist/safe-bash-command-pdfimages/index.d.ts +7 -1
- package/dist/safe-bash-command-pdfimages/index.js +63 -33
- package/dist/safe-bash-command-pdfinfo/index.d.ts +24 -20
- package/dist/safe-bash-command-pdfinfo/index.js +370 -161
- package/dist/safe-bash-command-pdftk/index.d.ts +7 -3
- package/dist/safe-bash-command-pdftk/index.js +114 -45
- package/dist/safe-bash-command-pdftoppm/index.d.ts +15 -7
- package/dist/safe-bash-command-pdftoppm/index.js +179 -109
- package/dist/safe-bash-command-pdftotext/index.d.ts +9 -5
- package/dist/safe-bash-command-pdftotext/index.js +90 -27
- package/dist/safe-bash-command-pptx/LICENSE +21 -0
- package/dist/safe-bash-command-pptx/index.d.ts +33 -0
- package/dist/safe-bash-command-pptx/index.js +168 -0
- package/dist/safe-bash-command-qpdf/index.d.ts +9 -3
- package/dist/safe-bash-command-qpdf/index.js +80 -29
- package/dist/safe-bash-command-sha512sum/index.js +12 -475
- package/dist/safe-bash-command-sips/index.d.ts +9 -5
- package/dist/safe-bash-command-sips/index.js +63 -44
- package/dist/safe-bash-command-soffice/index.d.ts +9 -3
- package/dist/safe-bash-command-soffice/index.js +65 -24
- package/dist/safe-bash-command-sqlite3/engine.d.ts +9 -0
- package/dist/safe-bash-command-sqlite3/index.d.ts +1 -0
- package/dist/safe-bash-command-sqlite3/index.js +851 -352
- package/dist/safe-bash-command-ssconvert/formats/xls.js +3 -3
- package/dist/safe-bash-command-timeout/index.js +3 -3
- package/dist/safe-bash-command-truncate/index.d.ts +8 -3
- package/dist/safe-bash-command-truncate/index.js +790 -272
- package/dist/safe-bash-command-truncate/sync.d.ts +1 -0
- package/dist/safe-bash-command-truncate/sync.js +60 -0
- package/dist/safe-bash-command-wkhtmltopdf/index.js +92 -38
- package/dist/safe-bash-command-wkhtmltopdf/pdf-renderer.d.ts +1 -1
- package/dist/safe-bash-command-xxd/index.js +78 -20
- package/dist/safe-bash-command-xz/command.d.ts +4 -0
- package/dist/safe-bash-command-xz/index.d.ts +1 -1
- package/dist/safe-bash-command-xz/index.js +1 -1
- package/dist/safe-bash-compression-engine/bounded-codec.js +3 -3
- package/dist/safe-bash-compression-engine/codec-loader.js +2 -2
- package/dist/safe-bash-compression-engine/files.js +6 -6
- package/dist/safe-bash-compression-engine/index.js +5 -5
- package/dist/safe-bash-compression-engine/operand.js +6 -6
- package/dist/safe-bash-compression-engine/stream.js +5 -5
- package/dist/safe-bash-compression-engine/zstd-decode.js +4 -4
- package/dist/safe-bash-contracts/command.js +3 -3
- package/dist/safe-bash-contracts/diagnostics.js +3 -3
- package/dist/safe-bash-contracts/escaping.js +9 -9
- package/dist/safe-bash-contracts/filesystem-descriptor.js +3 -3
- package/dist/safe-bash-contracts/filesystem-output.js +8 -8
- package/dist/safe-bash-contracts/index.js +21 -19
- package/dist/safe-bash-contracts/io.d.ts +12 -0
- package/dist/safe-bash-contracts/io.js +4 -1
- package/dist/safe-bash-contracts/output.js +3 -2
- package/dist/safe-bash-contracts/runtime-control.js +2 -2
- package/dist/safe-bash-contracts/signals.js +1 -1
- package/dist/safe-bash-contracts/yield.d.ts +1 -0
- package/dist/safe-bash-contracts/yield.js +3 -1
- package/dist/safe-bash-csv-engine/index.d.ts +10 -1
- package/dist/safe-bash-csv-engine/index.js +78 -6
- package/dist/safe-bash-io-engine/commands/search/requirements.js +3 -3
- package/dist/safe-bash-io-engine/commands/text-programs/shared.js +3 -3
- package/dist/safe-bash-io-engine/gnu-information.js +1 -1
- package/dist/safe-bash-io-engine/internal.d.ts +1 -1
- package/dist/safe-bash-io-engine/internal.js +2 -2
- package/dist/safe-bash-query-engine/index.js +4 -4
- package/dist/safe-bash-query-engine/interpreter.js +2 -2
- package/dist/safe-bash-query-engine/query-core.js +4 -4
- package/package.json +2 -2
- package/dist/safe-bash/opt-in/commands/cmp/compare.js +0 -95
- package/dist/safe-bash/opt-in/commands/cmp/io.js +0 -218
- package/dist/safe-bash/command-chunks/{chunk-FXYWQ6S4.js → chunk-2VTMZTV3.js} +0 -0
- package/dist/safe-bash/command-chunks/{chunk-RTOJNFFL.js → chunk-BJ6DGYJA.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-DEH3CMGL.js → chunk-QJ3ONEBI.js} +3 -3
|
@@ -7,18 +7,6 @@ export interface CmpCommandsOptions {
|
|
|
7
7
|
readonly comparisonBlockBytes?: number;
|
|
8
8
|
readonly limits?: Partial<CmpLimits>;
|
|
9
9
|
}
|
|
10
|
-
export declare const integerMaximum = 9223372036854775807n;
|
|
11
|
-
export interface CmpArguments {
|
|
12
|
-
readonly files: readonly [string, string];
|
|
13
|
-
readonly skips: readonly [bigint, bigint];
|
|
14
|
-
readonly count: bigint;
|
|
15
|
-
readonly mode: "first" | "all" | "silent";
|
|
16
|
-
readonly printBytes: boolean;
|
|
17
|
-
readonly information?: "help" | "version";
|
|
18
|
-
}
|
|
19
|
-
export declare class UsageError extends Error {
|
|
20
|
-
}
|
|
21
10
|
export declare function quote(value: string): string;
|
|
22
11
|
export declare function pathQuote(value: string): string;
|
|
23
|
-
export declare function parseArguments(args: readonly string[], posix: boolean): CmpArguments;
|
|
24
12
|
export declare function limitsFor(options: CmpCommandsOptions): CmpLimits;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
export const integerMaximum = 9223372036854775807n;
|
|
2
|
-
export class UsageError extends Error {
|
|
3
|
-
}
|
|
4
1
|
const escapes = new Map([[7, "a"], [8, "b"], [9, "t"], [10, "n"], [11, "v"], [12, "f"], [13, "r"]]);
|
|
5
2
|
export function quote(value) {
|
|
6
3
|
let result = "'";
|
|
@@ -35,156 +32,6 @@ export function pathQuote(value) {
|
|
|
35
32
|
}
|
|
36
33
|
return `${result}'`;
|
|
37
34
|
}
|
|
38
|
-
function countValue(text, kind) {
|
|
39
|
-
const invalid = () => { throw new UsageError(`invalid --${kind} value ${quote(text)}`); };
|
|
40
|
-
let position = 0;
|
|
41
|
-
while (position < text.length && " \t\n\r\v\f".includes(text[position]))
|
|
42
|
-
position++;
|
|
43
|
-
let negative = false;
|
|
44
|
-
if (text[position] === "+" || text[position] === "-")
|
|
45
|
-
negative = text[position++] === "-";
|
|
46
|
-
let base = 10;
|
|
47
|
-
if (text[position] === "0") {
|
|
48
|
-
base = 8;
|
|
49
|
-
if (text[position + 1]?.toLowerCase() === "x") {
|
|
50
|
-
base = 16;
|
|
51
|
-
position += 2;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
const start = position;
|
|
55
|
-
let value = 0n;
|
|
56
|
-
while (position < text.length) {
|
|
57
|
-
const digit = "0123456789abcdef".indexOf(text[position].toLowerCase());
|
|
58
|
-
if (digit < 0 || digit >= base)
|
|
59
|
-
break;
|
|
60
|
-
value = value * BigInt(base) + BigInt(digit);
|
|
61
|
-
if (value > integerMaximum)
|
|
62
|
-
value = integerMaximum + 1n;
|
|
63
|
-
position++;
|
|
64
|
-
}
|
|
65
|
-
const suffix = text.slice(position);
|
|
66
|
-
const power = suffix ? "KMGTPEZY".indexOf(suffix[0] === "k" ? "K" : suffix[0]) + 1 : 0;
|
|
67
|
-
if (position === start && (!power || base !== 10 || negative || start !== 0))
|
|
68
|
-
invalid();
|
|
69
|
-
if (position === start)
|
|
70
|
-
value = 1n;
|
|
71
|
-
if (suffix) {
|
|
72
|
-
if (!power || !["", "B", "D", "iB"].includes(suffix.slice(1)))
|
|
73
|
-
invalid();
|
|
74
|
-
value *= (suffix.endsWith("B") && !suffix.endsWith("iB") || suffix.endsWith("D") ? 1000n : 1024n) ** BigInt(power);
|
|
75
|
-
}
|
|
76
|
-
if (negative && value !== 0n)
|
|
77
|
-
invalid();
|
|
78
|
-
return value > integerMaximum ? integerMaximum + 1n : value;
|
|
79
|
-
}
|
|
80
|
-
const longOptions = [
|
|
81
|
-
["print-bytes", "b"], ["print-chars", "c"], ["ignore-initial", "i"], ["verbose", "l"],
|
|
82
|
-
["bytes", "n"], ["silent", "s"], ["quiet", "s"], ["version", "v"], ["help", "help"],
|
|
83
|
-
];
|
|
84
|
-
export function parseArguments(args, posix) {
|
|
85
|
-
const operands = [];
|
|
86
|
-
const skips = [0n, 0n];
|
|
87
|
-
let count = integerMaximum, mode = "first", printBytes = false, stopped = false;
|
|
88
|
-
const skip = (index, text) => {
|
|
89
|
-
const parsed = countValue(text, "ignore-initial");
|
|
90
|
-
if (skips[index] < integerMaximum && parsed > skips[index])
|
|
91
|
-
skips[index] = parsed;
|
|
92
|
-
};
|
|
93
|
-
const apply = (flag, value) => {
|
|
94
|
-
if (flag === "b" || flag === "c")
|
|
95
|
-
printBytes = true;
|
|
96
|
-
if (flag === "l" || flag === "s") {
|
|
97
|
-
const selected = flag === "l" ? "all" : "silent";
|
|
98
|
-
if (mode !== "first" && mode !== selected)
|
|
99
|
-
throw new UsageError("options -l and -s are incompatible");
|
|
100
|
-
mode = selected;
|
|
101
|
-
}
|
|
102
|
-
if (flag === "n") {
|
|
103
|
-
const parsed = countValue(value, "bytes");
|
|
104
|
-
if (parsed < count)
|
|
105
|
-
count = parsed;
|
|
106
|
-
}
|
|
107
|
-
if (flag === "i") {
|
|
108
|
-
const delimiter = value.indexOf(":");
|
|
109
|
-
if (delimiter < 0) {
|
|
110
|
-
skip(0, value);
|
|
111
|
-
if (skips[0] > skips[1])
|
|
112
|
-
skips[1] = skips[0];
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
try {
|
|
116
|
-
skip(0, value.slice(0, delimiter));
|
|
117
|
-
}
|
|
118
|
-
catch {
|
|
119
|
-
throw new UsageError(`invalid --ignore-initial value ${quote(value)}`);
|
|
120
|
-
}
|
|
121
|
-
skip(1, value.slice(delimiter + 1));
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
for (let index = 0; index < args.length; index++) {
|
|
126
|
-
const argument = args[index];
|
|
127
|
-
if (stopped || argument === "-" || !argument.startsWith("-")) {
|
|
128
|
-
operands.push(argument);
|
|
129
|
-
if (posix)
|
|
130
|
-
stopped = true;
|
|
131
|
-
continue;
|
|
132
|
-
}
|
|
133
|
-
if (argument === "--") {
|
|
134
|
-
stopped = true;
|
|
135
|
-
continue;
|
|
136
|
-
}
|
|
137
|
-
if (argument.startsWith("--")) {
|
|
138
|
-
const separator = argument.indexOf("=");
|
|
139
|
-
const name = argument.slice(2, separator < 0 ? undefined : separator);
|
|
140
|
-
const exact = longOptions.find(([option]) => option === name);
|
|
141
|
-
const matches = exact ? [exact] : longOptions.filter(([option]) => option.startsWith(name));
|
|
142
|
-
if (!matches.length)
|
|
143
|
-
throw new UsageError(`unrecognized option '${argument}'`);
|
|
144
|
-
if (matches.length > 1)
|
|
145
|
-
throw new UsageError(`option '${argument}' is ambiguous; possibilities:${matches.map(([option]) => ` '--${option}'`).join("")}`);
|
|
146
|
-
const flag = matches[0][1];
|
|
147
|
-
let value = separator < 0 ? undefined : argument.slice(separator + 1);
|
|
148
|
-
if (flag === "i" || flag === "n") {
|
|
149
|
-
if (value === undefined)
|
|
150
|
-
value = args[++index];
|
|
151
|
-
if (value === undefined)
|
|
152
|
-
throw new UsageError(`option '${argument}' requires an argument`);
|
|
153
|
-
}
|
|
154
|
-
else if (value !== undefined)
|
|
155
|
-
throw new UsageError(`option '--${matches[0][0]}' doesn't allow an argument`);
|
|
156
|
-
if (flag === "help" || flag === "v")
|
|
157
|
-
return { files: ["-", "-"], skips, count, mode, printBytes, information: flag === "v" ? "version" : "help" };
|
|
158
|
-
apply(flag, value);
|
|
159
|
-
}
|
|
160
|
-
else {
|
|
161
|
-
for (let offset = 1; offset < argument.length; offset++) {
|
|
162
|
-
const flag = argument[offset];
|
|
163
|
-
if (!"bci:ln:sv".includes(flag) || flag === ":")
|
|
164
|
-
throw new UsageError(`invalid option -- '${flag}'`);
|
|
165
|
-
if (flag === "v")
|
|
166
|
-
return { files: ["-", "-"], skips, count, mode, printBytes, information: "version" };
|
|
167
|
-
let value;
|
|
168
|
-
if (flag === "i" || flag === "n") {
|
|
169
|
-
value = argument.slice(offset + 1) || args[++index];
|
|
170
|
-
if (value === undefined)
|
|
171
|
-
throw new UsageError(`option requires an argument -- '${flag}'`);
|
|
172
|
-
offset = argument.length;
|
|
173
|
-
}
|
|
174
|
-
apply(flag, value);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
if (!operands.length)
|
|
179
|
-
throw new UsageError(`missing operand after ${quote(args.at(-1) ?? "cmp")}`);
|
|
180
|
-
if (operands[2] !== undefined)
|
|
181
|
-
skip(0, operands[2]);
|
|
182
|
-
if (operands[3] !== undefined)
|
|
183
|
-
skip(1, operands[3]);
|
|
184
|
-
if (operands[4] !== undefined)
|
|
185
|
-
throw new UsageError(`extra operand ${quote(operands[4])}`);
|
|
186
|
-
return { files: [operands[0], operands[1] ?? "-"], skips, count, mode, printBytes };
|
|
187
|
-
}
|
|
188
35
|
export function limitsFor(options) {
|
|
189
36
|
const limits = { maxChunkBytes: Infinity, maxFallbackBytes: Infinity, ...options.limits };
|
|
190
37
|
for (const [name, value] of Object.entries(options.limits ?? {})) {
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import { type CommandContext, type CommandDefinition, type FileStat, type VirtualShellPlugin } from "@poe-platform/safe-bash/contracts";
|
|
2
2
|
export interface TruncateLimits {
|
|
3
3
|
readonly maxArgumentBytes: number;
|
|
4
|
+
readonly maxArguments: number;
|
|
5
|
+
readonly maxOutputBytes: number;
|
|
6
|
+
readonly maxEntries: number;
|
|
4
7
|
}
|
|
5
8
|
export interface TruncateCommandsOptions {
|
|
6
|
-
readonly limits?: Partial<TruncateLimits>;
|
|
7
9
|
readonly replace?: boolean;
|
|
10
|
+
readonly umask?: number;
|
|
11
|
+
readonly limits?: Partial<TruncateLimits>;
|
|
8
12
|
readonly ioBlockSize?: (path: string, stat: FileStat, context: CommandContext) => number | Promise<number>;
|
|
9
13
|
readonly seekEnd?: (path: string, stat: FileStat, context: CommandContext) => number | Promise<number>;
|
|
10
14
|
}
|
|
11
|
-
export declare
|
|
12
|
-
export declare
|
|
15
|
+
export declare const createTruncateCommand: (options?: TruncateCommandsOptions | undefined) => CommandDefinition;
|
|
16
|
+
export declare const truncateCommand: (options?: TruncateCommandsOptions | undefined) => CommandDefinition;
|
|
17
|
+
export { evalSyncTruncate } from "./sync.js";
|
|
13
18
|
export declare function createTruncateCommands(options?: TruncateCommandsOptions): readonly CommandDefinition[];
|
|
14
19
|
export declare function truncateCommands(options?: TruncateCommandsOptions): VirtualShellPlugin;
|