ccusage 0.8.0 → 9.0.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/README.md +25 -5
- package/dist/calculate-cost.d.ts +2 -2
- package/dist/chunk-BLXvPPr8.js +30 -0
- package/dist/{data-loader-Bz6Vemxw.js → data-loader-Ca8k_uX0.js} +235 -294
- package/dist/{data-loader-amTZCtBR.d.ts → data-loader-OGaMjZTD.d.ts} +8 -80
- package/dist/data-loader.d.ts +3 -3
- package/dist/data-loader.js +5 -5
- package/dist/{debug-DQXeZIjf.js → debug-zCcXwR8p.js} +5 -4
- package/dist/debug.js +5 -5
- package/dist/{dist-DAarI-SJ.js → dist-BZzwBtZs.js} +1 -1
- package/dist/{effect-WSjEuzC9-ChJ5OQQf.js → effect-WSjEuzC9-DHMVzzyB.js} +1 -1
- package/dist/{esm-Dqsc1zmX.js → esm-BU3FhOe-.js} +1 -1
- package/dist/{index-CISmcbXk-x9eVmhGM.js → index-CISmcbXk-CW1Gj6Ab.js} +5 -5
- package/dist/index.js +199 -1760
- package/dist/{logger-DN-RT9jL.js → logger-DKw-DPXD.js} +3 -3
- package/dist/logger.js +1 -1
- package/dist/{mcp-DZXbfmbs.js → mcp-BRFYI5rd.js} +42 -50
- package/dist/mcp.d.ts +2 -2
- package/dist/mcp.js +7 -7
- package/dist/{pricing-fetcher-Dq-OLBp4.d.ts → pricing-fetcher-BkSZh4lR.d.ts} +83 -3
- package/dist/pricing-fetcher-BlxDpqFj.js +205 -0
- package/dist/pricing-fetcher.d.ts +2 -2
- package/dist/pricing-fetcher.js +3 -3
- package/dist/{sury-DmrZ3_Oj-l0qqtY-f.js → sury-DmrZ3_Oj-Cpjsc2Lm.js} +1 -1
- package/dist/utils.table-DRzF8vZJ.js +1838 -0
- package/dist/utils.table.d.ts +24 -0
- package/dist/utils.table.js +3 -0
- package/dist/valibot-CQk-M5rL-BcaCeUrF.js +10 -0
- package/dist/{zod-Db63SLXj-N1oN-yiY.js → zod-Db63SLXj-BIXn64AP.js} +3 -3
- package/package.json +2 -1
- package/dist/pricing-fetcher-DMNBE90M.js +0 -79
- package/dist/valibot-CQk-M5rL-BNHzwpA0.js +0 -10
- /package/dist/{arktype-C-GObzDh-Bx7Fdrqj.js → arktype-C-GObzDh-CNoBqQrr.js} +0 -0
- /package/dist/{core-B0ovMhJe.js → core-DHCbAXJf.js} +0 -0
- /package/dist/{dist-BEQ1tJCL.js → dist-DCvt9hEv.js} +0 -0
- /package/dist/{prompt-CUbwSrjo.js → prompt-DtZgx4wU.js} +0 -0
- /package/dist/{types-DS8M8QF_.js → types-BlyCnKwN.js} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { __commonJS,
|
|
2
|
+
import { __commonJS, __toESM } from "./chunk-BLXvPPr8.js";
|
|
3
3
|
import { calculateTotals, createTotalsObject, getTotalTokens } from "./calculate-cost-2IwHSzmi.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import "./
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import "./
|
|
10
|
-
import "./
|
|
4
|
+
import { formatDateCompact, getDefaultClaudePath, loadDailyUsageData, loadMonthlyUsageData, loadSessionData } from "./data-loader-Ca8k_uX0.js";
|
|
5
|
+
import { safeParse } from "./dist-DCvt9hEv.js";
|
|
6
|
+
import { description, log, logger, name, version } from "./logger-DKw-DPXD.js";
|
|
7
|
+
import { CostModes, SortOrders, dateSchema } from "./pricing-fetcher-BlxDpqFj.js";
|
|
8
|
+
import { detectMismatches, printMismatchReport } from "./debug-zCcXwR8p.js";
|
|
9
|
+
import { ResponsiveTable } from "./utils.table-DRzF8vZJ.js";
|
|
10
|
+
import "./types-BlyCnKwN.js";
|
|
11
|
+
import { createMcpServer } from "./mcp-BRFYI5rd.js";
|
|
12
|
+
import "./index-CISmcbXk-CW1Gj6Ab.js";
|
|
11
13
|
import process$1 from "node:process";
|
|
12
14
|
|
|
13
15
|
//#region node_modules/gunshi/lib/utils-D41C8Abf.js
|
|
@@ -175,7 +177,7 @@ const BUILT_IN_PREFIX_CODE = BUILT_IN_PREFIX.codePointAt(0);
|
|
|
175
177
|
* @param param A {@link CommandContextParams | parameters} to create a {@link CommandContext | command context}
|
|
176
178
|
* @returns A {@link CommandContext | command context}, which is readonly
|
|
177
179
|
*/
|
|
178
|
-
async function createCommandContext({ args, values, positionals, rest, argv, tokens, command, cliOptions, callMode = "entry", omitted = false }) {
|
|
180
|
+
async function createCommandContext({ args, values, positionals, rest, argv: argv$1, tokens, command, cliOptions, callMode = "entry", omitted = false }) {
|
|
179
181
|
/**
|
|
180
182
|
* normailize the options schema and values, to avoid prototype pollution
|
|
181
183
|
*/
|
|
@@ -238,7 +240,7 @@ async function createCommandContext({ args, values, positionals, rest, argv, tok
|
|
|
238
240
|
values,
|
|
239
241
|
positionals,
|
|
240
242
|
rest,
|
|
241
|
-
_: argv,
|
|
243
|
+
_: argv$1,
|
|
242
244
|
tokens,
|
|
243
245
|
toKebab: command.toKebab,
|
|
244
246
|
log: cliOptions.usageSilent ? NOOP : log$1,
|
|
@@ -332,18 +334,18 @@ const COMMON_ARGS_KEYS = Object.keys(COMMON_ARGS);
|
|
|
332
334
|
* @returns A rendered usage.
|
|
333
335
|
*/
|
|
334
336
|
async function renderUsage(ctx) {
|
|
335
|
-
const messages
|
|
337
|
+
const messages = [];
|
|
336
338
|
if (!ctx.omitted) {
|
|
337
339
|
const description$1 = resolveDescription(ctx);
|
|
338
|
-
if (description$1) messages
|
|
340
|
+
if (description$1) messages.push(description$1, "");
|
|
339
341
|
}
|
|
340
|
-
messages
|
|
341
|
-
if (ctx.omitted && await hasCommands(ctx)) messages
|
|
342
|
-
if (hasPositionalArgs(ctx)) messages
|
|
343
|
-
if (hasOptionalArgs(ctx)) messages
|
|
342
|
+
messages.push(...await renderUsageSection(ctx), "");
|
|
343
|
+
if (ctx.omitted && await hasCommands(ctx)) messages.push(...await renderCommandsSection(ctx), "");
|
|
344
|
+
if (hasPositionalArgs(ctx)) messages.push(...await renderPositionalArgsSection(ctx), "");
|
|
345
|
+
if (hasOptionalArgs(ctx)) messages.push(...await renderOptionalArgsSection(ctx), "");
|
|
344
346
|
const examples = await renderExamplesSection(ctx);
|
|
345
|
-
if (examples.length > 0) messages
|
|
346
|
-
return messages
|
|
347
|
+
if (examples.length > 0) messages.push(...examples, "");
|
|
348
|
+
return messages.join("\n");
|
|
347
349
|
}
|
|
348
350
|
/**
|
|
349
351
|
* Render the positional arguments section
|
|
@@ -351,10 +353,10 @@ async function renderUsage(ctx) {
|
|
|
351
353
|
* @returns A rendered arguments section
|
|
352
354
|
*/
|
|
353
355
|
async function renderPositionalArgsSection(ctx) {
|
|
354
|
-
const messages
|
|
355
|
-
messages
|
|
356
|
-
messages
|
|
357
|
-
return messages
|
|
356
|
+
const messages = [];
|
|
357
|
+
messages.push(`${ctx.translate(resolveBuiltInKey("ARGUMENTS"))}:`);
|
|
358
|
+
messages.push(await generatePositionalArgsUsage(ctx));
|
|
359
|
+
return messages;
|
|
358
360
|
}
|
|
359
361
|
/**
|
|
360
362
|
* Render the optional arguments section
|
|
@@ -362,10 +364,10 @@ async function renderPositionalArgsSection(ctx) {
|
|
|
362
364
|
* @returns A rendered options section
|
|
363
365
|
*/
|
|
364
366
|
async function renderOptionalArgsSection(ctx) {
|
|
365
|
-
const messages
|
|
366
|
-
messages
|
|
367
|
-
messages
|
|
368
|
-
return messages
|
|
367
|
+
const messages = [];
|
|
368
|
+
messages.push(`${ctx.translate(resolveBuiltInKey("OPTIONS"))}:`);
|
|
369
|
+
messages.push(await generateOptionalArgsUsage(ctx, getOptionalArgsPairs(ctx)));
|
|
370
|
+
return messages;
|
|
369
371
|
}
|
|
370
372
|
/**
|
|
371
373
|
* Render the examples section
|
|
@@ -373,13 +375,13 @@ async function renderOptionalArgsSection(ctx) {
|
|
|
373
375
|
* @returns A rendered examples section
|
|
374
376
|
*/
|
|
375
377
|
async function renderExamplesSection(ctx) {
|
|
376
|
-
const messages
|
|
378
|
+
const messages = [];
|
|
377
379
|
const resolvedExamples = await resolveExamples$1(ctx);
|
|
378
380
|
if (resolvedExamples) {
|
|
379
381
|
const examples = resolvedExamples.split("\n").map((example) => example.padStart(ctx.env.leftMargin + example.length));
|
|
380
|
-
messages
|
|
382
|
+
messages.push(`${ctx.translate(resolveBuiltInKey("EXAMPLES"))}:`, ...examples);
|
|
381
383
|
}
|
|
382
|
-
return messages
|
|
384
|
+
return messages;
|
|
383
385
|
}
|
|
384
386
|
/**
|
|
385
387
|
* Render the usage section
|
|
@@ -387,19 +389,19 @@ async function renderExamplesSection(ctx) {
|
|
|
387
389
|
* @returns A rendered usage section
|
|
388
390
|
*/
|
|
389
391
|
async function renderUsageSection(ctx) {
|
|
390
|
-
const messages
|
|
392
|
+
const messages = [`${ctx.translate(resolveBuiltInKey("USAGE"))}:`];
|
|
391
393
|
if (ctx.omitted) {
|
|
392
394
|
const defaultCommand = `${resolveEntry(ctx)}${await hasCommands(ctx) ? ` [${resolveSubCommand(ctx)}]` : ""} ${[generateOptionsSymbols(ctx), generatePositionalSymbols(ctx)].filter(Boolean).join(" ")}`;
|
|
393
|
-
messages
|
|
395
|
+
messages.push(defaultCommand.padStart(ctx.env.leftMargin + defaultCommand.length));
|
|
394
396
|
if (await hasCommands(ctx)) {
|
|
395
397
|
const commandsUsage = `${resolveEntry(ctx)} <${ctx.translate(resolveBuiltInKey("COMMANDS"))}>`;
|
|
396
|
-
messages
|
|
398
|
+
messages.push(commandsUsage.padStart(ctx.env.leftMargin + commandsUsage.length));
|
|
397
399
|
}
|
|
398
400
|
} else {
|
|
399
401
|
const usageStr = `${resolveEntry(ctx)} ${resolveSubCommand(ctx)} ${[generateOptionsSymbols(ctx), generatePositionalSymbols(ctx)].filter(Boolean).join(" ")}`;
|
|
400
|
-
messages
|
|
402
|
+
messages.push(usageStr.padStart(ctx.env.leftMargin + usageStr.length));
|
|
401
403
|
}
|
|
402
|
-
return messages
|
|
404
|
+
return messages;
|
|
403
405
|
}
|
|
404
406
|
/**
|
|
405
407
|
* Render the commands section
|
|
@@ -407,7 +409,7 @@ async function renderUsageSection(ctx) {
|
|
|
407
409
|
* @returns A rendered commands section
|
|
408
410
|
*/
|
|
409
411
|
async function renderCommandsSection(ctx) {
|
|
410
|
-
const messages
|
|
412
|
+
const messages = [`${ctx.translate(resolveBuiltInKey("COMMANDS"))}:`];
|
|
411
413
|
const loadedCommands = await ctx.loadCommands();
|
|
412
414
|
const commandMaxLength = Math.max(...loadedCommands.map((cmd) => (cmd.name || "").length));
|
|
413
415
|
const commandsStr = await Promise.all(loadedCommands.map((cmd) => {
|
|
@@ -416,12 +418,12 @@ async function renderCommandsSection(ctx) {
|
|
|
416
418
|
const command = `${key.padEnd(commandMaxLength + ctx.env.middleMargin)}${desc} `;
|
|
417
419
|
return `${command.padStart(ctx.env.leftMargin + command.length)} `;
|
|
418
420
|
}));
|
|
419
|
-
messages
|
|
420
|
-
messages
|
|
421
|
+
messages.push(...commandsStr, "", ctx.translate(resolveBuiltInKey("FORMORE")));
|
|
422
|
+
messages.push(...loadedCommands.map((cmd) => {
|
|
421
423
|
const commandHelp = `${ctx.env.name} ${cmd.name} --help`;
|
|
422
424
|
return `${commandHelp.padStart(ctx.env.leftMargin + commandHelp.length)}`;
|
|
423
425
|
}));
|
|
424
|
-
return messages
|
|
426
|
+
return messages;
|
|
425
427
|
}
|
|
426
428
|
/**
|
|
427
429
|
* Resolve the entry command name
|
|
@@ -592,9 +594,9 @@ function generatePositionalSymbols(ctx) {
|
|
|
592
594
|
* @returns A rendered validation error.
|
|
593
595
|
*/
|
|
594
596
|
function renderValidationErrors(_ctx, error) {
|
|
595
|
-
const messages
|
|
596
|
-
for (const err of error.errors) messages
|
|
597
|
-
return Promise.resolve(messages
|
|
597
|
+
const messages = [];
|
|
598
|
+
for (const err of error.errors) messages.push(err.message);
|
|
599
|
+
return Promise.resolve(messages.join("\n"));
|
|
598
600
|
}
|
|
599
601
|
|
|
600
602
|
//#endregion
|
|
@@ -1009,9 +1011,9 @@ function createTypeError(option, schema) {
|
|
|
1009
1011
|
* @param options A {@link CliOptions | CLI options}
|
|
1010
1012
|
* @returns A rendered usage or undefined. if you will use {@link CliOptions.usageSilent} option, it will return rendered usage string.
|
|
1011
1013
|
*/
|
|
1012
|
-
async function cli(argv, entry, options = {}) {
|
|
1014
|
+
async function cli(argv$1, entry, options = {}) {
|
|
1013
1015
|
const cliOptions = resolveCliOptions(options, entry);
|
|
1014
|
-
const tokens = parseArgs(argv);
|
|
1016
|
+
const tokens = parseArgs(argv$1);
|
|
1015
1017
|
const subCommand = getSubCommand(tokens);
|
|
1016
1018
|
const { commandName: name$1, command, callMode } = await resolveCommand(subCommand, entry, cliOptions);
|
|
1017
1019
|
if (!command) throw new Error(`Command not found: ${name$1 || ""}`);
|
|
@@ -1027,7 +1029,7 @@ async function cli(argv, entry, options = {}) {
|
|
|
1027
1029
|
values,
|
|
1028
1030
|
positionals,
|
|
1029
1031
|
rest,
|
|
1030
|
-
argv,
|
|
1032
|
+
argv: argv$1,
|
|
1031
1033
|
tokens,
|
|
1032
1034
|
omitted,
|
|
1033
1035
|
callMode,
|
|
@@ -1142,1675 +1144,72 @@ async function executeCommand(cmd, ctx, name$1) {
|
|
|
1142
1144
|
}
|
|
1143
1145
|
|
|
1144
1146
|
//#endregion
|
|
1145
|
-
//#region node_modules/
|
|
1146
|
-
var
|
|
1147
|
-
let
|
|
1148
|
-
let
|
|
1149
|
-
|
|
1150
|
-
|
|
1147
|
+
//#region node_modules/picocolors/picocolors.js
|
|
1148
|
+
var require_picocolors = __commonJS({ "node_modules/picocolors/picocolors.js"(exports, module) {
|
|
1149
|
+
let p = process || {}, argv = p.argv || [], env = p.env || {};
|
|
1150
|
+
let isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
1151
|
+
let formatter = (open, close, replace = open) => (input) => {
|
|
1152
|
+
let string = "" + input, index = string.indexOf(close, open.length);
|
|
1153
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
1151
1154
|
};
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1155
|
+
let replaceClose = (string, close, replace, index) => {
|
|
1156
|
+
let result = "", cursor = 0;
|
|
1157
|
+
do {
|
|
1158
|
+
result += string.substring(cursor, index) + replace;
|
|
1159
|
+
cursor = index + close.length;
|
|
1160
|
+
index = string.indexOf(close, cursor);
|
|
1161
|
+
} while (~index);
|
|
1162
|
+
return result + string.substring(cursor);
|
|
1157
1163
|
};
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
};
|
|
1161
|
-
debug$3.warn = (msg) => debug$3(msg, debug$3.WARN);
|
|
1162
|
-
debug$3.info = (msg) => debug$3(msg, debug$3.INFO);
|
|
1163
|
-
debug$3.debug = (msg) => debug$3(msg, debug$3.DEBUG);
|
|
1164
|
-
debug$3.debugMessages = () => messages;
|
|
1165
|
-
module.exports = debug$3;
|
|
1166
|
-
} });
|
|
1167
|
-
|
|
1168
|
-
//#endregion
|
|
1169
|
-
//#region node_modules/ansi-regex/index.js
|
|
1170
|
-
var require_ansi_regex = __commonJS({ "node_modules/ansi-regex/index.js"(exports, module) {
|
|
1171
|
-
module.exports = ({ onlyFirst = false } = {}) => {
|
|
1172
|
-
const pattern = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");
|
|
1173
|
-
return new RegExp(pattern, onlyFirst ? void 0 : "g");
|
|
1174
|
-
};
|
|
1175
|
-
} });
|
|
1176
|
-
|
|
1177
|
-
//#endregion
|
|
1178
|
-
//#region node_modules/strip-ansi/index.js
|
|
1179
|
-
var require_strip_ansi = __commonJS({ "node_modules/strip-ansi/index.js"(exports, module) {
|
|
1180
|
-
const ansiRegex = require_ansi_regex();
|
|
1181
|
-
module.exports = (string) => typeof string === "string" ? string.replace(ansiRegex(), "") : string;
|
|
1182
|
-
} });
|
|
1183
|
-
|
|
1184
|
-
//#endregion
|
|
1185
|
-
//#region node_modules/is-fullwidth-code-point/index.js
|
|
1186
|
-
var require_is_fullwidth_code_point = __commonJS({ "node_modules/is-fullwidth-code-point/index.js"(exports, module) {
|
|
1187
|
-
const isFullwidthCodePoint$1 = (codePoint) => {
|
|
1188
|
-
if (Number.isNaN(codePoint)) return false;
|
|
1189
|
-
if (codePoint >= 4352 && (codePoint <= 4447 || codePoint === 9001 || codePoint === 9002 || 11904 <= codePoint && codePoint <= 12871 && codePoint !== 12351 || 12880 <= codePoint && codePoint <= 19903 || 19968 <= codePoint && codePoint <= 42182 || 43360 <= codePoint && codePoint <= 43388 || 44032 <= codePoint && codePoint <= 55203 || 63744 <= codePoint && codePoint <= 64255 || 65040 <= codePoint && codePoint <= 65049 || 65072 <= codePoint && codePoint <= 65131 || 65281 <= codePoint && codePoint <= 65376 || 65504 <= codePoint && codePoint <= 65510 || 110592 <= codePoint && codePoint <= 110593 || 127488 <= codePoint && codePoint <= 127569 || 131072 <= codePoint && codePoint <= 262141)) return true;
|
|
1190
|
-
return false;
|
|
1191
|
-
};
|
|
1192
|
-
module.exports = isFullwidthCodePoint$1;
|
|
1193
|
-
module.exports.default = isFullwidthCodePoint$1;
|
|
1194
|
-
} });
|
|
1195
|
-
|
|
1196
|
-
//#endregion
|
|
1197
|
-
//#region node_modules/emoji-regex/index.js
|
|
1198
|
-
var require_emoji_regex = __commonJS({ "node_modules/emoji-regex/index.js"(exports, module) {
|
|
1199
|
-
module.exports = function() {
|
|
1200
|
-
return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
|
|
1201
|
-
};
|
|
1202
|
-
} });
|
|
1203
|
-
|
|
1204
|
-
//#endregion
|
|
1205
|
-
//#region node_modules/string-width/index.js
|
|
1206
|
-
var require_string_width = __commonJS({ "node_modules/string-width/index.js"(exports, module) {
|
|
1207
|
-
const stripAnsi = require_strip_ansi();
|
|
1208
|
-
const isFullwidthCodePoint = require_is_fullwidth_code_point();
|
|
1209
|
-
const emojiRegex = require_emoji_regex();
|
|
1210
|
-
const stringWidth$1 = (string) => {
|
|
1211
|
-
if (typeof string !== "string" || string.length === 0) return 0;
|
|
1212
|
-
string = stripAnsi(string);
|
|
1213
|
-
if (string.length === 0) return 0;
|
|
1214
|
-
string = string.replace(emojiRegex(), " ");
|
|
1215
|
-
let width = 0;
|
|
1216
|
-
for (let i = 0; i < string.length; i++) {
|
|
1217
|
-
const code = string.codePointAt(i);
|
|
1218
|
-
if (code <= 31 || code >= 127 && code <= 159) continue;
|
|
1219
|
-
if (code >= 768 && code <= 879) continue;
|
|
1220
|
-
if (code > 65535) i++;
|
|
1221
|
-
width += isFullwidthCodePoint(code) ? 2 : 1;
|
|
1222
|
-
}
|
|
1223
|
-
return width;
|
|
1224
|
-
};
|
|
1225
|
-
module.exports = stringWidth$1;
|
|
1226
|
-
module.exports.default = stringWidth$1;
|
|
1227
|
-
} });
|
|
1228
|
-
|
|
1229
|
-
//#endregion
|
|
1230
|
-
//#region node_modules/cli-table3/src/utils.js
|
|
1231
|
-
var require_utils = __commonJS({ "node_modules/cli-table3/src/utils.js"(exports, module) {
|
|
1232
|
-
const stringWidth = require_string_width();
|
|
1233
|
-
function codeRegex(capture) {
|
|
1234
|
-
return capture ? /\u001b\[((?:\d*;){0,5}\d*)m/g : /\u001b\[(?:\d*;){0,5}\d*m/g;
|
|
1235
|
-
}
|
|
1236
|
-
function strlen(str) {
|
|
1237
|
-
let code = codeRegex();
|
|
1238
|
-
let stripped = ("" + str).replace(code, "");
|
|
1239
|
-
let split = stripped.split("\n");
|
|
1240
|
-
return split.reduce(function(memo, s) {
|
|
1241
|
-
return stringWidth(s) > memo ? stringWidth(s) : memo;
|
|
1242
|
-
}, 0);
|
|
1243
|
-
}
|
|
1244
|
-
function repeat(str, times) {
|
|
1245
|
-
return Array(times + 1).join(str);
|
|
1246
|
-
}
|
|
1247
|
-
function pad(str, len, pad$1, dir) {
|
|
1248
|
-
let length = strlen(str);
|
|
1249
|
-
if (len + 1 >= length) {
|
|
1250
|
-
let padlen = len - length;
|
|
1251
|
-
switch (dir) {
|
|
1252
|
-
case "right": {
|
|
1253
|
-
str = repeat(pad$1, padlen) + str;
|
|
1254
|
-
break;
|
|
1255
|
-
}
|
|
1256
|
-
case "center": {
|
|
1257
|
-
let right = Math.ceil(padlen / 2);
|
|
1258
|
-
let left = padlen - right;
|
|
1259
|
-
str = repeat(pad$1, left) + str + repeat(pad$1, right);
|
|
1260
|
-
break;
|
|
1261
|
-
}
|
|
1262
|
-
default: {
|
|
1263
|
-
str = str + repeat(pad$1, padlen);
|
|
1264
|
-
break;
|
|
1265
|
-
}
|
|
1266
|
-
}
|
|
1267
|
-
}
|
|
1268
|
-
return str;
|
|
1269
|
-
}
|
|
1270
|
-
let codeCache = {};
|
|
1271
|
-
function addToCodeCache(name$1, on, off) {
|
|
1272
|
-
on = "\x1B[" + on + "m";
|
|
1273
|
-
off = "\x1B[" + off + "m";
|
|
1274
|
-
codeCache[on] = {
|
|
1275
|
-
set: name$1,
|
|
1276
|
-
to: true
|
|
1277
|
-
};
|
|
1278
|
-
codeCache[off] = {
|
|
1279
|
-
set: name$1,
|
|
1280
|
-
to: false
|
|
1281
|
-
};
|
|
1282
|
-
codeCache[name$1] = {
|
|
1283
|
-
on,
|
|
1284
|
-
off
|
|
1285
|
-
};
|
|
1286
|
-
}
|
|
1287
|
-
addToCodeCache("bold", 1, 22);
|
|
1288
|
-
addToCodeCache("italics", 3, 23);
|
|
1289
|
-
addToCodeCache("underline", 4, 24);
|
|
1290
|
-
addToCodeCache("inverse", 7, 27);
|
|
1291
|
-
addToCodeCache("strikethrough", 9, 29);
|
|
1292
|
-
function updateState(state, controlChars) {
|
|
1293
|
-
let controlCode = controlChars[1] ? parseInt(controlChars[1].split(";")[0]) : 0;
|
|
1294
|
-
if (controlCode >= 30 && controlCode <= 39 || controlCode >= 90 && controlCode <= 97) {
|
|
1295
|
-
state.lastForegroundAdded = controlChars[0];
|
|
1296
|
-
return;
|
|
1297
|
-
}
|
|
1298
|
-
if (controlCode >= 40 && controlCode <= 49 || controlCode >= 100 && controlCode <= 107) {
|
|
1299
|
-
state.lastBackgroundAdded = controlChars[0];
|
|
1300
|
-
return;
|
|
1301
|
-
}
|
|
1302
|
-
if (controlCode === 0) {
|
|
1303
|
-
for (let i in state)
|
|
1304
|
-
/* istanbul ignore else */
|
|
1305
|
-
if (Object.prototype.hasOwnProperty.call(state, i)) delete state[i];
|
|
1306
|
-
return;
|
|
1307
|
-
}
|
|
1308
|
-
let info$1 = codeCache[controlChars[0]];
|
|
1309
|
-
if (info$1) state[info$1.set] = info$1.to;
|
|
1310
|
-
}
|
|
1311
|
-
function readState(line) {
|
|
1312
|
-
let code = codeRegex(true);
|
|
1313
|
-
let controlChars = code.exec(line);
|
|
1314
|
-
let state = {};
|
|
1315
|
-
while (controlChars !== null) {
|
|
1316
|
-
updateState(state, controlChars);
|
|
1317
|
-
controlChars = code.exec(line);
|
|
1318
|
-
}
|
|
1319
|
-
return state;
|
|
1320
|
-
}
|
|
1321
|
-
function unwindState(state, ret) {
|
|
1322
|
-
let lastBackgroundAdded = state.lastBackgroundAdded;
|
|
1323
|
-
let lastForegroundAdded = state.lastForegroundAdded;
|
|
1324
|
-
delete state.lastBackgroundAdded;
|
|
1325
|
-
delete state.lastForegroundAdded;
|
|
1326
|
-
Object.keys(state).forEach(function(key) {
|
|
1327
|
-
if (state[key]) ret += codeCache[key].off;
|
|
1328
|
-
});
|
|
1329
|
-
if (lastBackgroundAdded && lastBackgroundAdded != "\x1B[49m") ret += "\x1B[49m";
|
|
1330
|
-
if (lastForegroundAdded && lastForegroundAdded != "\x1B[39m") ret += "\x1B[39m";
|
|
1331
|
-
return ret;
|
|
1332
|
-
}
|
|
1333
|
-
function rewindState(state, ret) {
|
|
1334
|
-
let lastBackgroundAdded = state.lastBackgroundAdded;
|
|
1335
|
-
let lastForegroundAdded = state.lastForegroundAdded;
|
|
1336
|
-
delete state.lastBackgroundAdded;
|
|
1337
|
-
delete state.lastForegroundAdded;
|
|
1338
|
-
Object.keys(state).forEach(function(key) {
|
|
1339
|
-
if (state[key]) ret = codeCache[key].on + ret;
|
|
1340
|
-
});
|
|
1341
|
-
if (lastBackgroundAdded && lastBackgroundAdded != "\x1B[49m") ret = lastBackgroundAdded + ret;
|
|
1342
|
-
if (lastForegroundAdded && lastForegroundAdded != "\x1B[39m") ret = lastForegroundAdded + ret;
|
|
1343
|
-
return ret;
|
|
1344
|
-
}
|
|
1345
|
-
function truncateWidth(str, desiredLength) {
|
|
1346
|
-
if (str.length === strlen(str)) return str.substr(0, desiredLength);
|
|
1347
|
-
while (strlen(str) > desiredLength) str = str.slice(0, -1);
|
|
1348
|
-
return str;
|
|
1349
|
-
}
|
|
1350
|
-
function truncateWidthWithAnsi(str, desiredLength) {
|
|
1351
|
-
let code = codeRegex(true);
|
|
1352
|
-
let split = str.split(codeRegex());
|
|
1353
|
-
let splitIndex = 0;
|
|
1354
|
-
let retLen = 0;
|
|
1355
|
-
let ret = "";
|
|
1356
|
-
let myArray;
|
|
1357
|
-
let state = {};
|
|
1358
|
-
while (retLen < desiredLength) {
|
|
1359
|
-
myArray = code.exec(str);
|
|
1360
|
-
let toAdd = split[splitIndex];
|
|
1361
|
-
splitIndex++;
|
|
1362
|
-
if (retLen + strlen(toAdd) > desiredLength) toAdd = truncateWidth(toAdd, desiredLength - retLen);
|
|
1363
|
-
ret += toAdd;
|
|
1364
|
-
retLen += strlen(toAdd);
|
|
1365
|
-
if (retLen < desiredLength) {
|
|
1366
|
-
if (!myArray) break;
|
|
1367
|
-
ret += myArray[0];
|
|
1368
|
-
updateState(state, myArray);
|
|
1369
|
-
}
|
|
1370
|
-
}
|
|
1371
|
-
return unwindState(state, ret);
|
|
1372
|
-
}
|
|
1373
|
-
function truncate(str, desiredLength, truncateChar) {
|
|
1374
|
-
truncateChar = truncateChar || "…";
|
|
1375
|
-
let lengthOfStr = strlen(str);
|
|
1376
|
-
if (lengthOfStr <= desiredLength) return str;
|
|
1377
|
-
desiredLength -= strlen(truncateChar);
|
|
1378
|
-
let ret = truncateWidthWithAnsi(str, desiredLength);
|
|
1379
|
-
ret += truncateChar;
|
|
1380
|
-
const hrefTag = "\x1B]8;;\x07";
|
|
1381
|
-
if (str.includes(hrefTag) && !ret.includes(hrefTag)) ret += hrefTag;
|
|
1382
|
-
return ret;
|
|
1383
|
-
}
|
|
1384
|
-
function defaultOptions() {
|
|
1385
|
-
return {
|
|
1386
|
-
chars: {
|
|
1387
|
-
top: "─",
|
|
1388
|
-
"top-mid": "┬",
|
|
1389
|
-
"top-left": "┌",
|
|
1390
|
-
"top-right": "┐",
|
|
1391
|
-
bottom: "─",
|
|
1392
|
-
"bottom-mid": "┴",
|
|
1393
|
-
"bottom-left": "└",
|
|
1394
|
-
"bottom-right": "┘",
|
|
1395
|
-
left: "│",
|
|
1396
|
-
"left-mid": "├",
|
|
1397
|
-
mid: "─",
|
|
1398
|
-
"mid-mid": "┼",
|
|
1399
|
-
right: "│",
|
|
1400
|
-
"right-mid": "┤",
|
|
1401
|
-
middle: "│"
|
|
1402
|
-
},
|
|
1403
|
-
truncate: "…",
|
|
1404
|
-
colWidths: [],
|
|
1405
|
-
rowHeights: [],
|
|
1406
|
-
colAligns: [],
|
|
1407
|
-
rowAligns: [],
|
|
1408
|
-
style: {
|
|
1409
|
-
"padding-left": 1,
|
|
1410
|
-
"padding-right": 1,
|
|
1411
|
-
head: ["red"],
|
|
1412
|
-
border: ["grey"],
|
|
1413
|
-
compact: false
|
|
1414
|
-
},
|
|
1415
|
-
head: []
|
|
1416
|
-
};
|
|
1417
|
-
}
|
|
1418
|
-
function mergeOptions(options, defaults) {
|
|
1419
|
-
options = options || {};
|
|
1420
|
-
defaults = defaults || defaultOptions();
|
|
1421
|
-
let ret = Object.assign({}, defaults, options);
|
|
1422
|
-
ret.chars = Object.assign({}, defaults.chars, options.chars);
|
|
1423
|
-
ret.style = Object.assign({}, defaults.style, options.style);
|
|
1424
|
-
return ret;
|
|
1425
|
-
}
|
|
1426
|
-
function wordWrap(maxLength, input) {
|
|
1427
|
-
let lines = [];
|
|
1428
|
-
let split = input.split(/(\s+)/g);
|
|
1429
|
-
let line = [];
|
|
1430
|
-
let lineLength = 0;
|
|
1431
|
-
let whitespace;
|
|
1432
|
-
for (let i = 0; i < split.length; i += 2) {
|
|
1433
|
-
let word = split[i];
|
|
1434
|
-
let newLength = lineLength + strlen(word);
|
|
1435
|
-
if (lineLength > 0 && whitespace) newLength += whitespace.length;
|
|
1436
|
-
if (newLength > maxLength) {
|
|
1437
|
-
if (lineLength !== 0) lines.push(line.join(""));
|
|
1438
|
-
line = [word];
|
|
1439
|
-
lineLength = strlen(word);
|
|
1440
|
-
} else {
|
|
1441
|
-
line.push(whitespace || "", word);
|
|
1442
|
-
lineLength = newLength;
|
|
1443
|
-
}
|
|
1444
|
-
whitespace = split[i + 1];
|
|
1445
|
-
}
|
|
1446
|
-
if (lineLength) lines.push(line.join(""));
|
|
1447
|
-
return lines;
|
|
1448
|
-
}
|
|
1449
|
-
function textWrap(maxLength, input) {
|
|
1450
|
-
let lines = [];
|
|
1451
|
-
let line = "";
|
|
1452
|
-
function pushLine(str, ws) {
|
|
1453
|
-
if (line.length && ws) line += ws;
|
|
1454
|
-
line += str;
|
|
1455
|
-
while (line.length > maxLength) {
|
|
1456
|
-
lines.push(line.slice(0, maxLength));
|
|
1457
|
-
line = line.slice(maxLength);
|
|
1458
|
-
}
|
|
1459
|
-
}
|
|
1460
|
-
let split = input.split(/(\s+)/g);
|
|
1461
|
-
for (let i = 0; i < split.length; i += 2) pushLine(split[i], i && split[i - 1]);
|
|
1462
|
-
if (line.length) lines.push(line);
|
|
1463
|
-
return lines;
|
|
1464
|
-
}
|
|
1465
|
-
function multiLineWordWrap(maxLength, input, wrapOnWordBoundary = true) {
|
|
1466
|
-
let output = [];
|
|
1467
|
-
input = input.split("\n");
|
|
1468
|
-
const handler = wrapOnWordBoundary ? wordWrap : textWrap;
|
|
1469
|
-
for (let i = 0; i < input.length; i++) output.push.apply(output, handler(maxLength, input[i]));
|
|
1470
|
-
return output;
|
|
1471
|
-
}
|
|
1472
|
-
function colorizeLines(input) {
|
|
1473
|
-
let state = {};
|
|
1474
|
-
let output = [];
|
|
1475
|
-
for (let i = 0; i < input.length; i++) {
|
|
1476
|
-
let line = rewindState(state, input[i]);
|
|
1477
|
-
state = readState(line);
|
|
1478
|
-
let temp = Object.assign({}, state);
|
|
1479
|
-
output.push(unwindState(temp, line));
|
|
1480
|
-
}
|
|
1481
|
-
return output;
|
|
1482
|
-
}
|
|
1483
|
-
/**
|
|
1484
|
-
* Credit: Matheus Sampaio https://github.com/matheussampaio
|
|
1485
|
-
*/
|
|
1486
|
-
function hyperlink(url, text) {
|
|
1487
|
-
const OSC = "\x1B]";
|
|
1488
|
-
const BEL = "\x07";
|
|
1489
|
-
const SEP = ";";
|
|
1490
|
-
return [
|
|
1491
|
-
OSC,
|
|
1492
|
-
"8",
|
|
1493
|
-
SEP,
|
|
1494
|
-
SEP,
|
|
1495
|
-
url || text,
|
|
1496
|
-
BEL,
|
|
1497
|
-
text,
|
|
1498
|
-
OSC,
|
|
1499
|
-
"8",
|
|
1500
|
-
SEP,
|
|
1501
|
-
SEP,
|
|
1502
|
-
BEL
|
|
1503
|
-
].join("");
|
|
1504
|
-
}
|
|
1505
|
-
module.exports = {
|
|
1506
|
-
strlen,
|
|
1507
|
-
repeat,
|
|
1508
|
-
pad,
|
|
1509
|
-
truncate,
|
|
1510
|
-
mergeOptions,
|
|
1511
|
-
wordWrap: multiLineWordWrap,
|
|
1512
|
-
colorizeLines,
|
|
1513
|
-
hyperlink
|
|
1514
|
-
};
|
|
1515
|
-
} });
|
|
1516
|
-
|
|
1517
|
-
//#endregion
|
|
1518
|
-
//#region node_modules/@colors/colors/lib/styles.js
|
|
1519
|
-
var require_styles = __commonJS({ "node_modules/@colors/colors/lib/styles.js"(exports, module) {
|
|
1520
|
-
var styles$1 = {};
|
|
1521
|
-
module["exports"] = styles$1;
|
|
1522
|
-
var codes = {
|
|
1523
|
-
reset: [0, 0],
|
|
1524
|
-
bold: [1, 22],
|
|
1525
|
-
dim: [2, 22],
|
|
1526
|
-
italic: [3, 23],
|
|
1527
|
-
underline: [4, 24],
|
|
1528
|
-
inverse: [7, 27],
|
|
1529
|
-
hidden: [8, 28],
|
|
1530
|
-
strikethrough: [9, 29],
|
|
1531
|
-
black: [30, 39],
|
|
1532
|
-
red: [31, 39],
|
|
1533
|
-
green: [32, 39],
|
|
1534
|
-
yellow: [33, 39],
|
|
1535
|
-
blue: [34, 39],
|
|
1536
|
-
magenta: [35, 39],
|
|
1537
|
-
cyan: [36, 39],
|
|
1538
|
-
white: [37, 39],
|
|
1539
|
-
gray: [90, 39],
|
|
1540
|
-
grey: [90, 39],
|
|
1541
|
-
brightRed: [91, 39],
|
|
1542
|
-
brightGreen: [92, 39],
|
|
1543
|
-
brightYellow: [93, 39],
|
|
1544
|
-
brightBlue: [94, 39],
|
|
1545
|
-
brightMagenta: [95, 39],
|
|
1546
|
-
brightCyan: [96, 39],
|
|
1547
|
-
brightWhite: [97, 39],
|
|
1548
|
-
bgBlack: [40, 49],
|
|
1549
|
-
bgRed: [41, 49],
|
|
1550
|
-
bgGreen: [42, 49],
|
|
1551
|
-
bgYellow: [43, 49],
|
|
1552
|
-
bgBlue: [44, 49],
|
|
1553
|
-
bgMagenta: [45, 49],
|
|
1554
|
-
bgCyan: [46, 49],
|
|
1555
|
-
bgWhite: [47, 49],
|
|
1556
|
-
bgGray: [100, 49],
|
|
1557
|
-
bgGrey: [100, 49],
|
|
1558
|
-
bgBrightRed: [101, 49],
|
|
1559
|
-
bgBrightGreen: [102, 49],
|
|
1560
|
-
bgBrightYellow: [103, 49],
|
|
1561
|
-
bgBrightBlue: [104, 49],
|
|
1562
|
-
bgBrightMagenta: [105, 49],
|
|
1563
|
-
bgBrightCyan: [106, 49],
|
|
1564
|
-
bgBrightWhite: [107, 49],
|
|
1565
|
-
blackBG: [40, 49],
|
|
1566
|
-
redBG: [41, 49],
|
|
1567
|
-
greenBG: [42, 49],
|
|
1568
|
-
yellowBG: [43, 49],
|
|
1569
|
-
blueBG: [44, 49],
|
|
1570
|
-
magentaBG: [45, 49],
|
|
1571
|
-
cyanBG: [46, 49],
|
|
1572
|
-
whiteBG: [47, 49]
|
|
1573
|
-
};
|
|
1574
|
-
Object.keys(codes).forEach(function(key) {
|
|
1575
|
-
var val = codes[key];
|
|
1576
|
-
var style = styles$1[key] = [];
|
|
1577
|
-
style.open = "\x1B[" + val[0] + "m";
|
|
1578
|
-
style.close = "\x1B[" + val[1] + "m";
|
|
1579
|
-
});
|
|
1580
|
-
} });
|
|
1581
|
-
|
|
1582
|
-
//#endregion
|
|
1583
|
-
//#region node_modules/@colors/colors/lib/system/has-flag.js
|
|
1584
|
-
var require_has_flag = __commonJS({ "node_modules/@colors/colors/lib/system/has-flag.js"(exports, module) {
|
|
1585
|
-
module.exports = function(flag, argv) {
|
|
1586
|
-
argv = argv || process.argv;
|
|
1587
|
-
var terminatorPos = argv.indexOf("--");
|
|
1588
|
-
var prefix = /^-{1,2}/.test(flag) ? "" : "--";
|
|
1589
|
-
var pos = argv.indexOf(prefix + flag);
|
|
1590
|
-
return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
|
|
1591
|
-
};
|
|
1592
|
-
} });
|
|
1593
|
-
|
|
1594
|
-
//#endregion
|
|
1595
|
-
//#region node_modules/@colors/colors/lib/system/supports-colors.js
|
|
1596
|
-
var require_supports_colors = __commonJS({ "node_modules/@colors/colors/lib/system/supports-colors.js"(exports, module) {
|
|
1597
|
-
var os = __require("os");
|
|
1598
|
-
var hasFlag = require_has_flag();
|
|
1599
|
-
var env = process.env;
|
|
1600
|
-
var forceColor = void 0;
|
|
1601
|
-
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false")) forceColor = false;
|
|
1602
|
-
else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) forceColor = true;
|
|
1603
|
-
if ("FORCE_COLOR" in env) forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
|
|
1604
|
-
function translateLevel(level$1) {
|
|
1605
|
-
if (level$1 === 0) return false;
|
|
1164
|
+
let createColors = (enabled = isColorSupported) => {
|
|
1165
|
+
let f = enabled ? formatter : () => String;
|
|
1606
1166
|
return {
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
}
|
|
1650
|
-
function getSupportLevel(stream) {
|
|
1651
|
-
var level$1 = supportsColor(stream);
|
|
1652
|
-
return translateLevel(level$1);
|
|
1653
|
-
}
|
|
1654
|
-
module.exports = {
|
|
1655
|
-
supportsColor: getSupportLevel,
|
|
1656
|
-
stdout: getSupportLevel(process.stdout),
|
|
1657
|
-
stderr: getSupportLevel(process.stderr)
|
|
1658
|
-
};
|
|
1659
|
-
} });
|
|
1660
|
-
|
|
1661
|
-
//#endregion
|
|
1662
|
-
//#region node_modules/@colors/colors/lib/custom/trap.js
|
|
1663
|
-
var require_trap = __commonJS({ "node_modules/@colors/colors/lib/custom/trap.js"(exports, module) {
|
|
1664
|
-
module["exports"] = function runTheTrap(text, options) {
|
|
1665
|
-
var result = "";
|
|
1666
|
-
text = text || "Run the trap, drop the bass";
|
|
1667
|
-
text = text.split("");
|
|
1668
|
-
var trap = {
|
|
1669
|
-
a: [
|
|
1670
|
-
"@",
|
|
1671
|
-
"Ą",
|
|
1672
|
-
"Ⱥ",
|
|
1673
|
-
"Ʌ",
|
|
1674
|
-
"Δ",
|
|
1675
|
-
"Λ",
|
|
1676
|
-
"Д"
|
|
1677
|
-
],
|
|
1678
|
-
b: [
|
|
1679
|
-
"ß",
|
|
1680
|
-
"Ɓ",
|
|
1681
|
-
"Ƀ",
|
|
1682
|
-
"ɮ",
|
|
1683
|
-
"β",
|
|
1684
|
-
"฿"
|
|
1685
|
-
],
|
|
1686
|
-
c: [
|
|
1687
|
-
"©",
|
|
1688
|
-
"Ȼ",
|
|
1689
|
-
"Ͼ"
|
|
1690
|
-
],
|
|
1691
|
-
d: [
|
|
1692
|
-
"Ð",
|
|
1693
|
-
"Ɗ",
|
|
1694
|
-
"Ԁ",
|
|
1695
|
-
"ԁ",
|
|
1696
|
-
"Ԃ",
|
|
1697
|
-
"ԃ"
|
|
1698
|
-
],
|
|
1699
|
-
e: [
|
|
1700
|
-
"Ë",
|
|
1701
|
-
"ĕ",
|
|
1702
|
-
"Ǝ",
|
|
1703
|
-
"ɘ",
|
|
1704
|
-
"Σ",
|
|
1705
|
-
"ξ",
|
|
1706
|
-
"Ҽ",
|
|
1707
|
-
"੬"
|
|
1708
|
-
],
|
|
1709
|
-
f: ["Ӻ"],
|
|
1710
|
-
g: ["ɢ"],
|
|
1711
|
-
h: [
|
|
1712
|
-
"Ħ",
|
|
1713
|
-
"ƕ",
|
|
1714
|
-
"Ң",
|
|
1715
|
-
"Һ",
|
|
1716
|
-
"Ӈ",
|
|
1717
|
-
"Ԋ"
|
|
1718
|
-
],
|
|
1719
|
-
i: ["༏"],
|
|
1720
|
-
j: ["Ĵ"],
|
|
1721
|
-
k: [
|
|
1722
|
-
"ĸ",
|
|
1723
|
-
"Ҡ",
|
|
1724
|
-
"Ӄ",
|
|
1725
|
-
"Ԟ"
|
|
1726
|
-
],
|
|
1727
|
-
l: ["Ĺ"],
|
|
1728
|
-
m: [
|
|
1729
|
-
"ʍ",
|
|
1730
|
-
"Ӎ",
|
|
1731
|
-
"ӎ",
|
|
1732
|
-
"Ԡ",
|
|
1733
|
-
"ԡ",
|
|
1734
|
-
"൩"
|
|
1735
|
-
],
|
|
1736
|
-
n: [
|
|
1737
|
-
"Ñ",
|
|
1738
|
-
"ŋ",
|
|
1739
|
-
"Ɲ",
|
|
1740
|
-
"Ͷ",
|
|
1741
|
-
"Π",
|
|
1742
|
-
"Ҋ"
|
|
1743
|
-
],
|
|
1744
|
-
o: [
|
|
1745
|
-
"Ø",
|
|
1746
|
-
"õ",
|
|
1747
|
-
"ø",
|
|
1748
|
-
"Ǿ",
|
|
1749
|
-
"ʘ",
|
|
1750
|
-
"Ѻ",
|
|
1751
|
-
"ם",
|
|
1752
|
-
"",
|
|
1753
|
-
"๏"
|
|
1754
|
-
],
|
|
1755
|
-
p: ["Ƿ", "Ҏ"],
|
|
1756
|
-
q: ["্"],
|
|
1757
|
-
r: [
|
|
1758
|
-
"®",
|
|
1759
|
-
"Ʀ",
|
|
1760
|
-
"Ȑ",
|
|
1761
|
-
"Ɍ",
|
|
1762
|
-
"ʀ",
|
|
1763
|
-
"Я"
|
|
1764
|
-
],
|
|
1765
|
-
s: [
|
|
1766
|
-
"§",
|
|
1767
|
-
"Ϟ",
|
|
1768
|
-
"ϟ",
|
|
1769
|
-
"Ϩ"
|
|
1770
|
-
],
|
|
1771
|
-
t: [
|
|
1772
|
-
"Ł",
|
|
1773
|
-
"Ŧ",
|
|
1774
|
-
"ͳ"
|
|
1775
|
-
],
|
|
1776
|
-
u: ["Ʊ", "Ս"],
|
|
1777
|
-
v: ["ט"],
|
|
1778
|
-
w: [
|
|
1779
|
-
"Ш",
|
|
1780
|
-
"Ѡ",
|
|
1781
|
-
"Ѽ",
|
|
1782
|
-
"൰"
|
|
1783
|
-
],
|
|
1784
|
-
x: [
|
|
1785
|
-
"Ҳ",
|
|
1786
|
-
"Ӿ",
|
|
1787
|
-
"Ӽ",
|
|
1788
|
-
"ӽ"
|
|
1789
|
-
],
|
|
1790
|
-
y: [
|
|
1791
|
-
"¥",
|
|
1792
|
-
"Ұ",
|
|
1793
|
-
"Ӌ"
|
|
1794
|
-
],
|
|
1795
|
-
z: ["Ƶ", "ɀ"]
|
|
1796
|
-
};
|
|
1797
|
-
text.forEach(function(c) {
|
|
1798
|
-
c = c.toLowerCase();
|
|
1799
|
-
var chars = trap[c] || [" "];
|
|
1800
|
-
var rand = Math.floor(Math.random() * chars.length);
|
|
1801
|
-
if (typeof trap[c] !== "undefined") result += trap[c][rand];
|
|
1802
|
-
else result += c;
|
|
1803
|
-
});
|
|
1804
|
-
return result;
|
|
1805
|
-
};
|
|
1806
|
-
} });
|
|
1807
|
-
|
|
1808
|
-
//#endregion
|
|
1809
|
-
//#region node_modules/@colors/colors/lib/custom/zalgo.js
|
|
1810
|
-
var require_zalgo = __commonJS({ "node_modules/@colors/colors/lib/custom/zalgo.js"(exports, module) {
|
|
1811
|
-
module["exports"] = function zalgo(text, options) {
|
|
1812
|
-
text = text || " he is here ";
|
|
1813
|
-
var soul = {
|
|
1814
|
-
"up": [
|
|
1815
|
-
"̍",
|
|
1816
|
-
"̎",
|
|
1817
|
-
"̄",
|
|
1818
|
-
"̅",
|
|
1819
|
-
"̿",
|
|
1820
|
-
"̑",
|
|
1821
|
-
"̆",
|
|
1822
|
-
"̐",
|
|
1823
|
-
"͒",
|
|
1824
|
-
"͗",
|
|
1825
|
-
"͑",
|
|
1826
|
-
"̇",
|
|
1827
|
-
"̈",
|
|
1828
|
-
"̊",
|
|
1829
|
-
"͂",
|
|
1830
|
-
"̓",
|
|
1831
|
-
"̈",
|
|
1832
|
-
"͊",
|
|
1833
|
-
"͋",
|
|
1834
|
-
"͌",
|
|
1835
|
-
"̃",
|
|
1836
|
-
"̂",
|
|
1837
|
-
"̌",
|
|
1838
|
-
"͐",
|
|
1839
|
-
"̀",
|
|
1840
|
-
"́",
|
|
1841
|
-
"̋",
|
|
1842
|
-
"̏",
|
|
1843
|
-
"̒",
|
|
1844
|
-
"̓",
|
|
1845
|
-
"̔",
|
|
1846
|
-
"̽",
|
|
1847
|
-
"̉",
|
|
1848
|
-
"ͣ",
|
|
1849
|
-
"ͤ",
|
|
1850
|
-
"ͥ",
|
|
1851
|
-
"ͦ",
|
|
1852
|
-
"ͧ",
|
|
1853
|
-
"ͨ",
|
|
1854
|
-
"ͩ",
|
|
1855
|
-
"ͪ",
|
|
1856
|
-
"ͫ",
|
|
1857
|
-
"ͬ",
|
|
1858
|
-
"ͭ",
|
|
1859
|
-
"ͮ",
|
|
1860
|
-
"ͯ",
|
|
1861
|
-
"̾",
|
|
1862
|
-
"͛",
|
|
1863
|
-
"͆",
|
|
1864
|
-
"̚"
|
|
1865
|
-
],
|
|
1866
|
-
"down": [
|
|
1867
|
-
"̖",
|
|
1868
|
-
"̗",
|
|
1869
|
-
"̘",
|
|
1870
|
-
"̙",
|
|
1871
|
-
"̜",
|
|
1872
|
-
"̝",
|
|
1873
|
-
"̞",
|
|
1874
|
-
"̟",
|
|
1875
|
-
"̠",
|
|
1876
|
-
"̤",
|
|
1877
|
-
"̥",
|
|
1878
|
-
"̦",
|
|
1879
|
-
"̩",
|
|
1880
|
-
"̪",
|
|
1881
|
-
"̫",
|
|
1882
|
-
"̬",
|
|
1883
|
-
"̭",
|
|
1884
|
-
"̮",
|
|
1885
|
-
"̯",
|
|
1886
|
-
"̰",
|
|
1887
|
-
"̱",
|
|
1888
|
-
"̲",
|
|
1889
|
-
"̳",
|
|
1890
|
-
"̹",
|
|
1891
|
-
"̺",
|
|
1892
|
-
"̻",
|
|
1893
|
-
"̼",
|
|
1894
|
-
"ͅ",
|
|
1895
|
-
"͇",
|
|
1896
|
-
"͈",
|
|
1897
|
-
"͉",
|
|
1898
|
-
"͍",
|
|
1899
|
-
"͎",
|
|
1900
|
-
"͓",
|
|
1901
|
-
"͔",
|
|
1902
|
-
"͕",
|
|
1903
|
-
"͖",
|
|
1904
|
-
"͙",
|
|
1905
|
-
"͚",
|
|
1906
|
-
"̣"
|
|
1907
|
-
],
|
|
1908
|
-
"mid": [
|
|
1909
|
-
"̕",
|
|
1910
|
-
"̛",
|
|
1911
|
-
"̀",
|
|
1912
|
-
"́",
|
|
1913
|
-
"͘",
|
|
1914
|
-
"̡",
|
|
1915
|
-
"̢",
|
|
1916
|
-
"̧",
|
|
1917
|
-
"̨",
|
|
1918
|
-
"̴",
|
|
1919
|
-
"̵",
|
|
1920
|
-
"̶",
|
|
1921
|
-
"͜",
|
|
1922
|
-
"͝",
|
|
1923
|
-
"͞",
|
|
1924
|
-
"͟",
|
|
1925
|
-
"͠",
|
|
1926
|
-
"͢",
|
|
1927
|
-
"̸",
|
|
1928
|
-
"̷",
|
|
1929
|
-
"͡",
|
|
1930
|
-
" ҉"
|
|
1931
|
-
]
|
|
1932
|
-
};
|
|
1933
|
-
var all = [].concat(soul.up, soul.down, soul.mid);
|
|
1934
|
-
function randomNumber(range) {
|
|
1935
|
-
var r = Math.floor(Math.random() * range);
|
|
1936
|
-
return r;
|
|
1937
|
-
}
|
|
1938
|
-
function isChar(character) {
|
|
1939
|
-
var bool = false;
|
|
1940
|
-
all.filter(function(i) {
|
|
1941
|
-
bool = i === character;
|
|
1942
|
-
});
|
|
1943
|
-
return bool;
|
|
1944
|
-
}
|
|
1945
|
-
function heComes(text$1, options$1) {
|
|
1946
|
-
var result = "";
|
|
1947
|
-
var counts;
|
|
1948
|
-
var l;
|
|
1949
|
-
options$1 = options$1 || {};
|
|
1950
|
-
options$1["up"] = typeof options$1["up"] !== "undefined" ? options$1["up"] : true;
|
|
1951
|
-
options$1["mid"] = typeof options$1["mid"] !== "undefined" ? options$1["mid"] : true;
|
|
1952
|
-
options$1["down"] = typeof options$1["down"] !== "undefined" ? options$1["down"] : true;
|
|
1953
|
-
options$1["size"] = typeof options$1["size"] !== "undefined" ? options$1["size"] : "maxi";
|
|
1954
|
-
text$1 = text$1.split("");
|
|
1955
|
-
for (l in text$1) {
|
|
1956
|
-
if (isChar(l)) continue;
|
|
1957
|
-
result = result + text$1[l];
|
|
1958
|
-
counts = {
|
|
1959
|
-
"up": 0,
|
|
1960
|
-
"down": 0,
|
|
1961
|
-
"mid": 0
|
|
1962
|
-
};
|
|
1963
|
-
switch (options$1.size) {
|
|
1964
|
-
case "mini":
|
|
1965
|
-
counts.up = randomNumber(8);
|
|
1966
|
-
counts.mid = randomNumber(2);
|
|
1967
|
-
counts.down = randomNumber(8);
|
|
1968
|
-
break;
|
|
1969
|
-
case "maxi":
|
|
1970
|
-
counts.up = randomNumber(16) + 3;
|
|
1971
|
-
counts.mid = randomNumber(4) + 1;
|
|
1972
|
-
counts.down = randomNumber(64) + 3;
|
|
1973
|
-
break;
|
|
1974
|
-
default:
|
|
1975
|
-
counts.up = randomNumber(8) + 1;
|
|
1976
|
-
counts.mid = randomNumber(6) / 2;
|
|
1977
|
-
counts.down = randomNumber(8) + 1;
|
|
1978
|
-
break;
|
|
1979
|
-
}
|
|
1980
|
-
var arr = [
|
|
1981
|
-
"up",
|
|
1982
|
-
"mid",
|
|
1983
|
-
"down"
|
|
1984
|
-
];
|
|
1985
|
-
for (var d in arr) {
|
|
1986
|
-
var index = arr[d];
|
|
1987
|
-
for (var i = 0; i <= counts[index]; i++) if (options$1[index]) result = result + soul[index][randomNumber(soul[index].length)];
|
|
1988
|
-
}
|
|
1989
|
-
}
|
|
1990
|
-
return result;
|
|
1991
|
-
}
|
|
1992
|
-
return heComes(text, options);
|
|
1993
|
-
};
|
|
1994
|
-
} });
|
|
1995
|
-
|
|
1996
|
-
//#endregion
|
|
1997
|
-
//#region node_modules/@colors/colors/lib/maps/america.js
|
|
1998
|
-
var require_america = __commonJS({ "node_modules/@colors/colors/lib/maps/america.js"(exports, module) {
|
|
1999
|
-
module["exports"] = function(colors$2) {
|
|
2000
|
-
return function(letter, i, exploded) {
|
|
2001
|
-
if (letter === " ") return letter;
|
|
2002
|
-
switch (i % 3) {
|
|
2003
|
-
case 0: return colors$2.red(letter);
|
|
2004
|
-
case 1: return colors$2.white(letter);
|
|
2005
|
-
case 2: return colors$2.blue(letter);
|
|
2006
|
-
}
|
|
2007
|
-
};
|
|
2008
|
-
};
|
|
2009
|
-
} });
|
|
2010
|
-
|
|
2011
|
-
//#endregion
|
|
2012
|
-
//#region node_modules/@colors/colors/lib/maps/zebra.js
|
|
2013
|
-
var require_zebra = __commonJS({ "node_modules/@colors/colors/lib/maps/zebra.js"(exports, module) {
|
|
2014
|
-
module["exports"] = function(colors$2) {
|
|
2015
|
-
return function(letter, i, exploded) {
|
|
2016
|
-
return i % 2 === 0 ? letter : colors$2.inverse(letter);
|
|
2017
|
-
};
|
|
2018
|
-
};
|
|
2019
|
-
} });
|
|
2020
|
-
|
|
2021
|
-
//#endregion
|
|
2022
|
-
//#region node_modules/@colors/colors/lib/maps/rainbow.js
|
|
2023
|
-
var require_rainbow = __commonJS({ "node_modules/@colors/colors/lib/maps/rainbow.js"(exports, module) {
|
|
2024
|
-
module["exports"] = function(colors$2) {
|
|
2025
|
-
var rainbowColors = [
|
|
2026
|
-
"red",
|
|
2027
|
-
"yellow",
|
|
2028
|
-
"green",
|
|
2029
|
-
"blue",
|
|
2030
|
-
"magenta"
|
|
2031
|
-
];
|
|
2032
|
-
return function(letter, i, exploded) {
|
|
2033
|
-
if (letter === " ") return letter;
|
|
2034
|
-
else return colors$2[rainbowColors[i++ % rainbowColors.length]](letter);
|
|
2035
|
-
};
|
|
2036
|
-
};
|
|
2037
|
-
} });
|
|
2038
|
-
|
|
2039
|
-
//#endregion
|
|
2040
|
-
//#region node_modules/@colors/colors/lib/maps/random.js
|
|
2041
|
-
var require_random = __commonJS({ "node_modules/@colors/colors/lib/maps/random.js"(exports, module) {
|
|
2042
|
-
module["exports"] = function(colors$2) {
|
|
2043
|
-
var available = [
|
|
2044
|
-
"underline",
|
|
2045
|
-
"inverse",
|
|
2046
|
-
"grey",
|
|
2047
|
-
"yellow",
|
|
2048
|
-
"red",
|
|
2049
|
-
"green",
|
|
2050
|
-
"blue",
|
|
2051
|
-
"white",
|
|
2052
|
-
"cyan",
|
|
2053
|
-
"magenta",
|
|
2054
|
-
"brightYellow",
|
|
2055
|
-
"brightRed",
|
|
2056
|
-
"brightGreen",
|
|
2057
|
-
"brightBlue",
|
|
2058
|
-
"brightWhite",
|
|
2059
|
-
"brightCyan",
|
|
2060
|
-
"brightMagenta"
|
|
2061
|
-
];
|
|
2062
|
-
return function(letter, i, exploded) {
|
|
2063
|
-
return letter === " " ? letter : colors$2[available[Math.round(Math.random() * (available.length - 2))]](letter);
|
|
2064
|
-
};
|
|
2065
|
-
};
|
|
2066
|
-
} });
|
|
2067
|
-
|
|
2068
|
-
//#endregion
|
|
2069
|
-
//#region node_modules/@colors/colors/lib/colors.js
|
|
2070
|
-
var require_colors = __commonJS({ "node_modules/@colors/colors/lib/colors.js"(exports, module) {
|
|
2071
|
-
var colors$1 = {};
|
|
2072
|
-
module["exports"] = colors$1;
|
|
2073
|
-
colors$1.themes = {};
|
|
2074
|
-
var util = __require("util");
|
|
2075
|
-
var ansiStyles = colors$1.styles = require_styles();
|
|
2076
|
-
var defineProps = Object.defineProperties;
|
|
2077
|
-
var newLineRegex = new RegExp(/[\r\n]+/g);
|
|
2078
|
-
colors$1.supportsColor = require_supports_colors().supportsColor;
|
|
2079
|
-
if (typeof colors$1.enabled === "undefined") colors$1.enabled = colors$1.supportsColor() !== false;
|
|
2080
|
-
colors$1.enable = function() {
|
|
2081
|
-
colors$1.enabled = true;
|
|
2082
|
-
};
|
|
2083
|
-
colors$1.disable = function() {
|
|
2084
|
-
colors$1.enabled = false;
|
|
2085
|
-
};
|
|
2086
|
-
colors$1.stripColors = colors$1.strip = function(str) {
|
|
2087
|
-
return ("" + str).replace(/\x1B\[\d+m/g, "");
|
|
2088
|
-
};
|
|
2089
|
-
var stylize = colors$1.stylize = function stylize$1(str, style) {
|
|
2090
|
-
if (!colors$1.enabled) return str + "";
|
|
2091
|
-
var styleMap = ansiStyles[style];
|
|
2092
|
-
if (!styleMap && style in colors$1) return colors$1[style](str);
|
|
2093
|
-
return styleMap.open + str + styleMap.close;
|
|
2094
|
-
};
|
|
2095
|
-
var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
|
|
2096
|
-
var escapeStringRegexp = function(str) {
|
|
2097
|
-
if (typeof str !== "string") throw new TypeError("Expected a string");
|
|
2098
|
-
return str.replace(matchOperatorsRe, "\\$&");
|
|
2099
|
-
};
|
|
2100
|
-
function build(_styles) {
|
|
2101
|
-
var builder = function builder$1() {
|
|
2102
|
-
return applyStyle.apply(builder$1, arguments);
|
|
2103
|
-
};
|
|
2104
|
-
builder._styles = _styles;
|
|
2105
|
-
builder.__proto__ = proto;
|
|
2106
|
-
return builder;
|
|
2107
|
-
}
|
|
2108
|
-
var styles = function() {
|
|
2109
|
-
var ret = {};
|
|
2110
|
-
ansiStyles.grey = ansiStyles.gray;
|
|
2111
|
-
Object.keys(ansiStyles).forEach(function(key) {
|
|
2112
|
-
ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), "g");
|
|
2113
|
-
ret[key] = { get: function() {
|
|
2114
|
-
return build(this._styles.concat(key));
|
|
2115
|
-
} };
|
|
2116
|
-
});
|
|
2117
|
-
return ret;
|
|
2118
|
-
}();
|
|
2119
|
-
var proto = defineProps(function colors$2() {}, styles);
|
|
2120
|
-
function applyStyle() {
|
|
2121
|
-
var args = Array.prototype.slice.call(arguments);
|
|
2122
|
-
var str = args.map(function(arg) {
|
|
2123
|
-
if (arg != null && arg.constructor === String) return arg;
|
|
2124
|
-
else return util.inspect(arg);
|
|
2125
|
-
}).join(" ");
|
|
2126
|
-
if (!colors$1.enabled || !str) return str;
|
|
2127
|
-
var newLinesPresent = str.indexOf("\n") != -1;
|
|
2128
|
-
var nestedStyles = this._styles;
|
|
2129
|
-
var i = nestedStyles.length;
|
|
2130
|
-
while (i--) {
|
|
2131
|
-
var code = ansiStyles[nestedStyles[i]];
|
|
2132
|
-
str = code.open + str.replace(code.closeRe, code.open) + code.close;
|
|
2133
|
-
if (newLinesPresent) str = str.replace(newLineRegex, function(match) {
|
|
2134
|
-
return code.close + match + code.open;
|
|
2135
|
-
});
|
|
2136
|
-
}
|
|
2137
|
-
return str;
|
|
2138
|
-
}
|
|
2139
|
-
colors$1.setTheme = function(theme) {
|
|
2140
|
-
if (typeof theme === "string") {
|
|
2141
|
-
console.log("colors.setTheme now only accepts an object, not a string. If you are trying to set a theme from a file, it is now your (the caller's) responsibility to require the file. The old syntax looked like colors.setTheme(__dirname + '/../themes/generic-logging.js'); The new syntax looks like colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));");
|
|
2142
|
-
return;
|
|
2143
|
-
}
|
|
2144
|
-
for (var style in theme) (function(style$1) {
|
|
2145
|
-
colors$1[style$1] = function(str) {
|
|
2146
|
-
if (typeof theme[style$1] === "object") {
|
|
2147
|
-
var out = str;
|
|
2148
|
-
for (var i in theme[style$1]) out = colors$1[theme[style$1][i]](out);
|
|
2149
|
-
return out;
|
|
2150
|
-
}
|
|
2151
|
-
return colors$1[theme[style$1]](str);
|
|
2152
|
-
};
|
|
2153
|
-
})(style);
|
|
2154
|
-
};
|
|
2155
|
-
function init() {
|
|
2156
|
-
var ret = {};
|
|
2157
|
-
Object.keys(styles).forEach(function(name$1) {
|
|
2158
|
-
ret[name$1] = { get: function() {
|
|
2159
|
-
return build([name$1]);
|
|
2160
|
-
} };
|
|
2161
|
-
});
|
|
2162
|
-
return ret;
|
|
2163
|
-
}
|
|
2164
|
-
var sequencer = function sequencer$1(map$1, str) {
|
|
2165
|
-
var exploded = str.split("");
|
|
2166
|
-
exploded = exploded.map(map$1);
|
|
2167
|
-
return exploded.join("");
|
|
2168
|
-
};
|
|
2169
|
-
colors$1.trap = require_trap();
|
|
2170
|
-
colors$1.zalgo = require_zalgo();
|
|
2171
|
-
colors$1.maps = {};
|
|
2172
|
-
colors$1.maps.america = require_america()(colors$1);
|
|
2173
|
-
colors$1.maps.zebra = require_zebra()(colors$1);
|
|
2174
|
-
colors$1.maps.rainbow = require_rainbow()(colors$1);
|
|
2175
|
-
colors$1.maps.random = require_random()(colors$1);
|
|
2176
|
-
for (var map in colors$1.maps) (function(map$1) {
|
|
2177
|
-
colors$1[map$1] = function(str) {
|
|
2178
|
-
return sequencer(colors$1.maps[map$1], str);
|
|
2179
|
-
};
|
|
2180
|
-
})(map);
|
|
2181
|
-
defineProps(colors$1, init());
|
|
2182
|
-
} });
|
|
2183
|
-
|
|
2184
|
-
//#endregion
|
|
2185
|
-
//#region node_modules/@colors/colors/safe.js
|
|
2186
|
-
var require_safe = __commonJS({ "node_modules/@colors/colors/safe.js"(exports, module) {
|
|
2187
|
-
var colors = require_colors();
|
|
2188
|
-
module["exports"] = colors;
|
|
2189
|
-
} });
|
|
2190
|
-
|
|
2191
|
-
//#endregion
|
|
2192
|
-
//#region node_modules/cli-table3/src/cell.js
|
|
2193
|
-
var require_cell = __commonJS({ "node_modules/cli-table3/src/cell.js"(exports, module) {
|
|
2194
|
-
const { info, debug: debug$2 } = require_debug$1();
|
|
2195
|
-
const utils$1 = require_utils();
|
|
2196
|
-
var Cell$1 = class Cell$1 {
|
|
2197
|
-
/**
|
|
2198
|
-
* A representation of a cell within the table.
|
|
2199
|
-
* Implementations must have `init` and `draw` methods,
|
|
2200
|
-
* as well as `colSpan`, `rowSpan`, `desiredHeight` and `desiredWidth` properties.
|
|
2201
|
-
* @param options
|
|
2202
|
-
* @constructor
|
|
2203
|
-
*/
|
|
2204
|
-
constructor(options) {
|
|
2205
|
-
this.setOptions(options);
|
|
2206
|
-
/**
|
|
2207
|
-
* Each cell will have it's `x` and `y` values set by the `layout-manager` prior to
|
|
2208
|
-
* `init` being called;
|
|
2209
|
-
* @type {Number}
|
|
2210
|
-
*/
|
|
2211
|
-
this.x = null;
|
|
2212
|
-
this.y = null;
|
|
2213
|
-
}
|
|
2214
|
-
setOptions(options) {
|
|
2215
|
-
if ([
|
|
2216
|
-
"boolean",
|
|
2217
|
-
"number",
|
|
2218
|
-
"bigint",
|
|
2219
|
-
"string"
|
|
2220
|
-
].indexOf(typeof options) !== -1) options = { content: "" + options };
|
|
2221
|
-
options = options || {};
|
|
2222
|
-
this.options = options;
|
|
2223
|
-
let content = options.content;
|
|
2224
|
-
if ([
|
|
2225
|
-
"boolean",
|
|
2226
|
-
"number",
|
|
2227
|
-
"bigint",
|
|
2228
|
-
"string"
|
|
2229
|
-
].indexOf(typeof content) !== -1) this.content = String(content);
|
|
2230
|
-
else if (!content) this.content = this.options.href || "";
|
|
2231
|
-
else throw new Error("Content needs to be a primitive, got: " + typeof content);
|
|
2232
|
-
this.colSpan = options.colSpan || 1;
|
|
2233
|
-
this.rowSpan = options.rowSpan || 1;
|
|
2234
|
-
if (this.options.href) Object.defineProperty(this, "href", { get() {
|
|
2235
|
-
return this.options.href;
|
|
2236
|
-
} });
|
|
2237
|
-
}
|
|
2238
|
-
mergeTableOptions(tableOptions, cells) {
|
|
2239
|
-
this.cells = cells;
|
|
2240
|
-
let optionsChars = this.options.chars || {};
|
|
2241
|
-
let tableChars = tableOptions.chars;
|
|
2242
|
-
let chars = this.chars = {};
|
|
2243
|
-
CHAR_NAMES.forEach(function(name$1) {
|
|
2244
|
-
setOption(optionsChars, tableChars, name$1, chars);
|
|
2245
|
-
});
|
|
2246
|
-
this.truncate = this.options.truncate || tableOptions.truncate;
|
|
2247
|
-
let style = this.options.style = this.options.style || {};
|
|
2248
|
-
let tableStyle = tableOptions.style;
|
|
2249
|
-
setOption(style, tableStyle, "padding-left", this);
|
|
2250
|
-
setOption(style, tableStyle, "padding-right", this);
|
|
2251
|
-
this.head = style.head || tableStyle.head;
|
|
2252
|
-
this.border = style.border || tableStyle.border;
|
|
2253
|
-
this.fixedWidth = tableOptions.colWidths[this.x];
|
|
2254
|
-
this.lines = this.computeLines(tableOptions);
|
|
2255
|
-
this.desiredWidth = utils$1.strlen(this.content) + this.paddingLeft + this.paddingRight;
|
|
2256
|
-
this.desiredHeight = this.lines.length;
|
|
2257
|
-
}
|
|
2258
|
-
computeLines(tableOptions) {
|
|
2259
|
-
const tableWordWrap = tableOptions.wordWrap || tableOptions.textWrap;
|
|
2260
|
-
const { wordWrap: wordWrap$1 = tableWordWrap } = this.options;
|
|
2261
|
-
if (this.fixedWidth && wordWrap$1) {
|
|
2262
|
-
this.fixedWidth -= this.paddingLeft + this.paddingRight;
|
|
2263
|
-
if (this.colSpan) {
|
|
2264
|
-
let i = 1;
|
|
2265
|
-
while (i < this.colSpan) {
|
|
2266
|
-
this.fixedWidth += tableOptions.colWidths[this.x + i];
|
|
2267
|
-
i++;
|
|
2268
|
-
}
|
|
2269
|
-
}
|
|
2270
|
-
const { wrapOnWordBoundary: tableWrapOnWordBoundary = true } = tableOptions;
|
|
2271
|
-
const { wrapOnWordBoundary = tableWrapOnWordBoundary } = this.options;
|
|
2272
|
-
return this.wrapLines(utils$1.wordWrap(this.fixedWidth, this.content, wrapOnWordBoundary));
|
|
2273
|
-
}
|
|
2274
|
-
return this.wrapLines(this.content.split("\n"));
|
|
2275
|
-
}
|
|
2276
|
-
wrapLines(computedLines) {
|
|
2277
|
-
const lines = utils$1.colorizeLines(computedLines);
|
|
2278
|
-
if (this.href) return lines.map((line) => utils$1.hyperlink(this.href, line));
|
|
2279
|
-
return lines;
|
|
2280
|
-
}
|
|
2281
|
-
/**
|
|
2282
|
-
* Initializes the Cells data structure.
|
|
2283
|
-
*
|
|
2284
|
-
* @param tableOptions - A fully populated set of tableOptions.
|
|
2285
|
-
* In addition to the standard default values, tableOptions must have fully populated the
|
|
2286
|
-
* `colWidths` and `rowWidths` arrays. Those arrays must have lengths equal to the number
|
|
2287
|
-
* of columns or rows (respectively) in this table, and each array item must be a Number.
|
|
2288
|
-
*
|
|
2289
|
-
*/
|
|
2290
|
-
init(tableOptions) {
|
|
2291
|
-
let x = this.x;
|
|
2292
|
-
let y = this.y;
|
|
2293
|
-
this.widths = tableOptions.colWidths.slice(x, x + this.colSpan);
|
|
2294
|
-
this.heights = tableOptions.rowHeights.slice(y, y + this.rowSpan);
|
|
2295
|
-
this.width = this.widths.reduce(sumPlusOne, -1);
|
|
2296
|
-
this.height = this.heights.reduce(sumPlusOne, -1);
|
|
2297
|
-
this.hAlign = this.options.hAlign || tableOptions.colAligns[x];
|
|
2298
|
-
this.vAlign = this.options.vAlign || tableOptions.rowAligns[y];
|
|
2299
|
-
this.drawRight = x + this.colSpan == tableOptions.colWidths.length;
|
|
2300
|
-
}
|
|
2301
|
-
/**
|
|
2302
|
-
* Draws the given line of the cell.
|
|
2303
|
-
* This default implementation defers to methods `drawTop`, `drawBottom`, `drawLine` and `drawEmpty`.
|
|
2304
|
-
* @param lineNum - can be `top`, `bottom` or a numerical line number.
|
|
2305
|
-
* @param spanningCell - will be a number if being called from a RowSpanCell, and will represent how
|
|
2306
|
-
* many rows below it's being called from. Otherwise it's undefined.
|
|
2307
|
-
* @returns {String} The representation of this line.
|
|
2308
|
-
*/
|
|
2309
|
-
draw(lineNum, spanningCell) {
|
|
2310
|
-
if (lineNum == "top") return this.drawTop(this.drawRight);
|
|
2311
|
-
if (lineNum == "bottom") return this.drawBottom(this.drawRight);
|
|
2312
|
-
let content = utils$1.truncate(this.content, 10, this.truncate);
|
|
2313
|
-
if (!lineNum) info(`${this.y}-${this.x}: ${this.rowSpan - lineNum}x${this.colSpan} Cell ${content}`);
|
|
2314
|
-
let padLen = Math.max(this.height - this.lines.length, 0);
|
|
2315
|
-
let padTop;
|
|
2316
|
-
switch (this.vAlign) {
|
|
2317
|
-
case "center":
|
|
2318
|
-
padTop = Math.ceil(padLen / 2);
|
|
2319
|
-
break;
|
|
2320
|
-
case "bottom":
|
|
2321
|
-
padTop = padLen;
|
|
2322
|
-
break;
|
|
2323
|
-
default: padTop = 0;
|
|
2324
|
-
}
|
|
2325
|
-
if (lineNum < padTop || lineNum >= padTop + this.lines.length) return this.drawEmpty(this.drawRight, spanningCell);
|
|
2326
|
-
let forceTruncation = this.lines.length > this.height && lineNum + 1 >= this.height;
|
|
2327
|
-
return this.drawLine(lineNum - padTop, this.drawRight, forceTruncation, spanningCell);
|
|
2328
|
-
}
|
|
2329
|
-
/**
|
|
2330
|
-
* Renders the top line of the cell.
|
|
2331
|
-
* @param drawRight - true if this method should render the right edge of the cell.
|
|
2332
|
-
* @returns {String}
|
|
2333
|
-
*/
|
|
2334
|
-
drawTop(drawRight) {
|
|
2335
|
-
let content = [];
|
|
2336
|
-
if (this.cells) this.widths.forEach(function(width, index) {
|
|
2337
|
-
content.push(this._topLeftChar(index));
|
|
2338
|
-
content.push(utils$1.repeat(this.chars[this.y == 0 ? "top" : "mid"], width));
|
|
2339
|
-
}, this);
|
|
2340
|
-
else {
|
|
2341
|
-
content.push(this._topLeftChar(0));
|
|
2342
|
-
content.push(utils$1.repeat(this.chars[this.y == 0 ? "top" : "mid"], this.width));
|
|
2343
|
-
}
|
|
2344
|
-
if (drawRight) content.push(this.chars[this.y == 0 ? "topRight" : "rightMid"]);
|
|
2345
|
-
return this.wrapWithStyleColors("border", content.join(""));
|
|
2346
|
-
}
|
|
2347
|
-
_topLeftChar(offset) {
|
|
2348
|
-
let x = this.x + offset;
|
|
2349
|
-
let leftChar;
|
|
2350
|
-
if (this.y == 0) leftChar = x == 0 ? "topLeft" : offset == 0 ? "topMid" : "top";
|
|
2351
|
-
else if (x == 0) leftChar = "leftMid";
|
|
2352
|
-
else {
|
|
2353
|
-
leftChar = offset == 0 ? "midMid" : "bottomMid";
|
|
2354
|
-
if (this.cells) {
|
|
2355
|
-
let spanAbove = this.cells[this.y - 1][x] instanceof Cell$1.ColSpanCell;
|
|
2356
|
-
if (spanAbove) leftChar = offset == 0 ? "topMid" : "mid";
|
|
2357
|
-
if (offset == 0) {
|
|
2358
|
-
let i = 1;
|
|
2359
|
-
while (this.cells[this.y][x - i] instanceof Cell$1.ColSpanCell) i++;
|
|
2360
|
-
if (this.cells[this.y][x - i] instanceof Cell$1.RowSpanCell) leftChar = "leftMid";
|
|
2361
|
-
}
|
|
2362
|
-
}
|
|
2363
|
-
}
|
|
2364
|
-
return this.chars[leftChar];
|
|
2365
|
-
}
|
|
2366
|
-
wrapWithStyleColors(styleProperty, content) {
|
|
2367
|
-
if (this[styleProperty] && this[styleProperty].length) try {
|
|
2368
|
-
let colors$2 = require_safe();
|
|
2369
|
-
for (let i = this[styleProperty].length - 1; i >= 0; i--) colors$2 = colors$2[this[styleProperty][i]];
|
|
2370
|
-
return colors$2(content);
|
|
2371
|
-
} catch (e) {
|
|
2372
|
-
return content;
|
|
2373
|
-
}
|
|
2374
|
-
else return content;
|
|
2375
|
-
}
|
|
2376
|
-
/**
|
|
2377
|
-
* Renders a line of text.
|
|
2378
|
-
* @param lineNum - Which line of text to render. This is not necessarily the line within the cell.
|
|
2379
|
-
* There may be top-padding above the first line of text.
|
|
2380
|
-
* @param drawRight - true if this method should render the right edge of the cell.
|
|
2381
|
-
* @param forceTruncationSymbol - `true` if the rendered text should end with the truncation symbol even
|
|
2382
|
-
* if the text fits. This is used when the cell is vertically truncated. If `false` the text should
|
|
2383
|
-
* only include the truncation symbol if the text will not fit horizontally within the cell width.
|
|
2384
|
-
* @param spanningCell - a number of if being called from a RowSpanCell. (how many rows below). otherwise undefined.
|
|
2385
|
-
* @returns {String}
|
|
2386
|
-
*/
|
|
2387
|
-
drawLine(lineNum, drawRight, forceTruncationSymbol, spanningCell) {
|
|
2388
|
-
let left = this.chars[this.x == 0 ? "left" : "middle"];
|
|
2389
|
-
if (this.x && spanningCell && this.cells) {
|
|
2390
|
-
let cellLeft = this.cells[this.y + spanningCell][this.x - 1];
|
|
2391
|
-
while (cellLeft instanceof ColSpanCell$1) cellLeft = this.cells[cellLeft.y][cellLeft.x - 1];
|
|
2392
|
-
if (!(cellLeft instanceof RowSpanCell$1)) left = this.chars["rightMid"];
|
|
2393
|
-
}
|
|
2394
|
-
let leftPadding = utils$1.repeat(" ", this.paddingLeft);
|
|
2395
|
-
let right = drawRight ? this.chars["right"] : "";
|
|
2396
|
-
let rightPadding = utils$1.repeat(" ", this.paddingRight);
|
|
2397
|
-
let line = this.lines[lineNum];
|
|
2398
|
-
let len = this.width - (this.paddingLeft + this.paddingRight);
|
|
2399
|
-
if (forceTruncationSymbol) line += this.truncate || "…";
|
|
2400
|
-
let content = utils$1.truncate(line, len, this.truncate);
|
|
2401
|
-
content = utils$1.pad(content, len, " ", this.hAlign);
|
|
2402
|
-
content = leftPadding + content + rightPadding;
|
|
2403
|
-
return this.stylizeLine(left, content, right);
|
|
2404
|
-
}
|
|
2405
|
-
stylizeLine(left, content, right) {
|
|
2406
|
-
left = this.wrapWithStyleColors("border", left);
|
|
2407
|
-
right = this.wrapWithStyleColors("border", right);
|
|
2408
|
-
if (this.y === 0) content = this.wrapWithStyleColors("head", content);
|
|
2409
|
-
return left + content + right;
|
|
2410
|
-
}
|
|
2411
|
-
/**
|
|
2412
|
-
* Renders the bottom line of the cell.
|
|
2413
|
-
* @param drawRight - true if this method should render the right edge of the cell.
|
|
2414
|
-
* @returns {String}
|
|
2415
|
-
*/
|
|
2416
|
-
drawBottom(drawRight) {
|
|
2417
|
-
let left = this.chars[this.x == 0 ? "bottomLeft" : "bottomMid"];
|
|
2418
|
-
let content = utils$1.repeat(this.chars.bottom, this.width);
|
|
2419
|
-
let right = drawRight ? this.chars["bottomRight"] : "";
|
|
2420
|
-
return this.wrapWithStyleColors("border", left + content + right);
|
|
2421
|
-
}
|
|
2422
|
-
/**
|
|
2423
|
-
* Renders a blank line of text within the cell. Used for top and/or bottom padding.
|
|
2424
|
-
* @param drawRight - true if this method should render the right edge of the cell.
|
|
2425
|
-
* @param spanningCell - a number of if being called from a RowSpanCell. (how many rows below). otherwise undefined.
|
|
2426
|
-
* @returns {String}
|
|
2427
|
-
*/
|
|
2428
|
-
drawEmpty(drawRight, spanningCell) {
|
|
2429
|
-
let left = this.chars[this.x == 0 ? "left" : "middle"];
|
|
2430
|
-
if (this.x && spanningCell && this.cells) {
|
|
2431
|
-
let cellLeft = this.cells[this.y + spanningCell][this.x - 1];
|
|
2432
|
-
while (cellLeft instanceof ColSpanCell$1) cellLeft = this.cells[cellLeft.y][cellLeft.x - 1];
|
|
2433
|
-
if (!(cellLeft instanceof RowSpanCell$1)) left = this.chars["rightMid"];
|
|
2434
|
-
}
|
|
2435
|
-
let right = drawRight ? this.chars["right"] : "";
|
|
2436
|
-
let content = utils$1.repeat(" ", this.width);
|
|
2437
|
-
return this.stylizeLine(left, content, right);
|
|
2438
|
-
}
|
|
2439
|
-
};
|
|
2440
|
-
var ColSpanCell$1 = class {
|
|
2441
|
-
/**
|
|
2442
|
-
* A Cell that doesn't do anything. It just draws empty lines.
|
|
2443
|
-
* Used as a placeholder in column spanning.
|
|
2444
|
-
* @constructor
|
|
2445
|
-
*/
|
|
2446
|
-
constructor() {}
|
|
2447
|
-
draw(lineNum) {
|
|
2448
|
-
if (typeof lineNum === "number") debug$2(`${this.y}-${this.x}: 1x1 ColSpanCell`);
|
|
2449
|
-
return "";
|
|
2450
|
-
}
|
|
2451
|
-
init() {}
|
|
2452
|
-
mergeTableOptions() {}
|
|
2453
|
-
};
|
|
2454
|
-
var RowSpanCell$1 = class {
|
|
2455
|
-
/**
|
|
2456
|
-
* A placeholder Cell for a Cell that spans multiple rows.
|
|
2457
|
-
* It delegates rendering to the original cell, but adds the appropriate offset.
|
|
2458
|
-
* @param originalCell
|
|
2459
|
-
* @constructor
|
|
2460
|
-
*/
|
|
2461
|
-
constructor(originalCell) {
|
|
2462
|
-
this.originalCell = originalCell;
|
|
2463
|
-
}
|
|
2464
|
-
init(tableOptions) {
|
|
2465
|
-
let y = this.y;
|
|
2466
|
-
let originalY = this.originalCell.y;
|
|
2467
|
-
this.cellOffset = y - originalY;
|
|
2468
|
-
this.offset = findDimension(tableOptions.rowHeights, originalY, this.cellOffset);
|
|
2469
|
-
}
|
|
2470
|
-
draw(lineNum) {
|
|
2471
|
-
if (lineNum == "top") return this.originalCell.draw(this.offset, this.cellOffset);
|
|
2472
|
-
if (lineNum == "bottom") return this.originalCell.draw("bottom");
|
|
2473
|
-
debug$2(`${this.y}-${this.x}: 1x${this.colSpan} RowSpanCell for ${this.originalCell.content}`);
|
|
2474
|
-
return this.originalCell.draw(this.offset + 1 + lineNum);
|
|
2475
|
-
}
|
|
2476
|
-
mergeTableOptions() {}
|
|
2477
|
-
};
|
|
2478
|
-
function firstDefined(...args) {
|
|
2479
|
-
return args.filter((v) => v !== void 0 && v !== null).shift();
|
|
2480
|
-
}
|
|
2481
|
-
function setOption(objA, objB, nameB, targetObj) {
|
|
2482
|
-
let nameA = nameB.split("-");
|
|
2483
|
-
if (nameA.length > 1) {
|
|
2484
|
-
nameA[1] = nameA[1].charAt(0).toUpperCase() + nameA[1].substr(1);
|
|
2485
|
-
nameA = nameA.join("");
|
|
2486
|
-
targetObj[nameA] = firstDefined(objA[nameA], objA[nameB], objB[nameA], objB[nameB]);
|
|
2487
|
-
} else targetObj[nameB] = firstDefined(objA[nameB], objB[nameB]);
|
|
2488
|
-
}
|
|
2489
|
-
function findDimension(dimensionTable, startingIndex, span) {
|
|
2490
|
-
let ret = dimensionTable[startingIndex];
|
|
2491
|
-
for (let i = 1; i < span; i++) ret += 1 + dimensionTable[startingIndex + i];
|
|
2492
|
-
return ret;
|
|
2493
|
-
}
|
|
2494
|
-
function sumPlusOne(a, b) {
|
|
2495
|
-
return a + b + 1;
|
|
2496
|
-
}
|
|
2497
|
-
let CHAR_NAMES = [
|
|
2498
|
-
"top",
|
|
2499
|
-
"top-mid",
|
|
2500
|
-
"top-left",
|
|
2501
|
-
"top-right",
|
|
2502
|
-
"bottom",
|
|
2503
|
-
"bottom-mid",
|
|
2504
|
-
"bottom-left",
|
|
2505
|
-
"bottom-right",
|
|
2506
|
-
"left",
|
|
2507
|
-
"left-mid",
|
|
2508
|
-
"mid",
|
|
2509
|
-
"mid-mid",
|
|
2510
|
-
"right",
|
|
2511
|
-
"right-mid",
|
|
2512
|
-
"middle"
|
|
2513
|
-
];
|
|
2514
|
-
module.exports = Cell$1;
|
|
2515
|
-
module.exports.ColSpanCell = ColSpanCell$1;
|
|
2516
|
-
module.exports.RowSpanCell = RowSpanCell$1;
|
|
2517
|
-
} });
|
|
2518
|
-
|
|
2519
|
-
//#endregion
|
|
2520
|
-
//#region node_modules/cli-table3/src/layout-manager.js
|
|
2521
|
-
var require_layout_manager = __commonJS({ "node_modules/cli-table3/src/layout-manager.js"(exports, module) {
|
|
2522
|
-
const { warn, debug: debug$1 } = require_debug$1();
|
|
2523
|
-
const Cell = require_cell();
|
|
2524
|
-
const { ColSpanCell, RowSpanCell } = Cell;
|
|
2525
|
-
(function() {
|
|
2526
|
-
function next(alloc, col) {
|
|
2527
|
-
if (alloc[col] > 0) return next(alloc, col + 1);
|
|
2528
|
-
return col;
|
|
2529
|
-
}
|
|
2530
|
-
function layoutTable(table) {
|
|
2531
|
-
let alloc = {};
|
|
2532
|
-
table.forEach(function(row, rowIndex) {
|
|
2533
|
-
let col = 0;
|
|
2534
|
-
row.forEach(function(cell) {
|
|
2535
|
-
cell.y = rowIndex;
|
|
2536
|
-
cell.x = rowIndex ? next(alloc, col) : col;
|
|
2537
|
-
const rowSpan = cell.rowSpan || 1;
|
|
2538
|
-
const colSpan = cell.colSpan || 1;
|
|
2539
|
-
if (rowSpan > 1) for (let cs = 0; cs < colSpan; cs++) alloc[cell.x + cs] = rowSpan;
|
|
2540
|
-
col = cell.x + colSpan;
|
|
2541
|
-
});
|
|
2542
|
-
Object.keys(alloc).forEach((idx) => {
|
|
2543
|
-
alloc[idx]--;
|
|
2544
|
-
if (alloc[idx] < 1) delete alloc[idx];
|
|
2545
|
-
});
|
|
2546
|
-
});
|
|
2547
|
-
}
|
|
2548
|
-
function maxWidth(table) {
|
|
2549
|
-
let mw = 0;
|
|
2550
|
-
table.forEach(function(row) {
|
|
2551
|
-
row.forEach(function(cell) {
|
|
2552
|
-
mw = Math.max(mw, cell.x + (cell.colSpan || 1));
|
|
2553
|
-
});
|
|
2554
|
-
});
|
|
2555
|
-
return mw;
|
|
2556
|
-
}
|
|
2557
|
-
function maxHeight(table) {
|
|
2558
|
-
return table.length;
|
|
2559
|
-
}
|
|
2560
|
-
function cellsConflict(cell1, cell2) {
|
|
2561
|
-
let yMin1 = cell1.y;
|
|
2562
|
-
let yMax1 = cell1.y - 1 + (cell1.rowSpan || 1);
|
|
2563
|
-
let yMin2 = cell2.y;
|
|
2564
|
-
let yMax2 = cell2.y - 1 + (cell2.rowSpan || 1);
|
|
2565
|
-
let yConflict = !(yMin1 > yMax2 || yMin2 > yMax1);
|
|
2566
|
-
let xMin1 = cell1.x;
|
|
2567
|
-
let xMax1 = cell1.x - 1 + (cell1.colSpan || 1);
|
|
2568
|
-
let xMin2 = cell2.x;
|
|
2569
|
-
let xMax2 = cell2.x - 1 + (cell2.colSpan || 1);
|
|
2570
|
-
let xConflict = !(xMin1 > xMax2 || xMin2 > xMax1);
|
|
2571
|
-
return yConflict && xConflict;
|
|
2572
|
-
}
|
|
2573
|
-
function conflictExists(rows, x, y) {
|
|
2574
|
-
let i_max = Math.min(rows.length - 1, y);
|
|
2575
|
-
let cell = {
|
|
2576
|
-
x,
|
|
2577
|
-
y
|
|
2578
|
-
};
|
|
2579
|
-
for (let i = 0; i <= i_max; i++) {
|
|
2580
|
-
let row = rows[i];
|
|
2581
|
-
for (let j = 0; j < row.length; j++) if (cellsConflict(cell, row[j])) return true;
|
|
2582
|
-
}
|
|
2583
|
-
return false;
|
|
2584
|
-
}
|
|
2585
|
-
function allBlank(rows, y, xMin, xMax) {
|
|
2586
|
-
for (let x = xMin; x < xMax; x++) if (conflictExists(rows, x, y)) return false;
|
|
2587
|
-
return true;
|
|
2588
|
-
}
|
|
2589
|
-
function addRowSpanCells(table) {
|
|
2590
|
-
table.forEach(function(row, rowIndex) {
|
|
2591
|
-
row.forEach(function(cell) {
|
|
2592
|
-
for (let i = 1; i < cell.rowSpan; i++) {
|
|
2593
|
-
let rowSpanCell = new RowSpanCell(cell);
|
|
2594
|
-
rowSpanCell.x = cell.x;
|
|
2595
|
-
rowSpanCell.y = cell.y + i;
|
|
2596
|
-
rowSpanCell.colSpan = cell.colSpan;
|
|
2597
|
-
insertCell(rowSpanCell, table[rowIndex + i]);
|
|
2598
|
-
}
|
|
2599
|
-
});
|
|
2600
|
-
});
|
|
2601
|
-
}
|
|
2602
|
-
function addColSpanCells(cellRows) {
|
|
2603
|
-
for (let rowIndex = cellRows.length - 1; rowIndex >= 0; rowIndex--) {
|
|
2604
|
-
let cellColumns = cellRows[rowIndex];
|
|
2605
|
-
for (let columnIndex = 0; columnIndex < cellColumns.length; columnIndex++) {
|
|
2606
|
-
let cell = cellColumns[columnIndex];
|
|
2607
|
-
for (let k = 1; k < cell.colSpan; k++) {
|
|
2608
|
-
let colSpanCell = new ColSpanCell();
|
|
2609
|
-
colSpanCell.x = cell.x + k;
|
|
2610
|
-
colSpanCell.y = cell.y;
|
|
2611
|
-
cellColumns.splice(columnIndex + 1, 0, colSpanCell);
|
|
2612
|
-
}
|
|
2613
|
-
}
|
|
2614
|
-
}
|
|
2615
|
-
}
|
|
2616
|
-
function insertCell(cell, row) {
|
|
2617
|
-
let x = 0;
|
|
2618
|
-
while (x < row.length && row[x].x < cell.x) x++;
|
|
2619
|
-
row.splice(x, 0, cell);
|
|
2620
|
-
}
|
|
2621
|
-
function fillInTable(table) {
|
|
2622
|
-
let h_max = maxHeight(table);
|
|
2623
|
-
let w_max = maxWidth(table);
|
|
2624
|
-
debug$1(`Max rows: ${h_max}; Max cols: ${w_max}`);
|
|
2625
|
-
for (let y = 0; y < h_max; y++) for (let x = 0; x < w_max; x++) if (!conflictExists(table, x, y)) {
|
|
2626
|
-
let opts = {
|
|
2627
|
-
x,
|
|
2628
|
-
y,
|
|
2629
|
-
colSpan: 1,
|
|
2630
|
-
rowSpan: 1
|
|
2631
|
-
};
|
|
2632
|
-
x++;
|
|
2633
|
-
while (x < w_max && !conflictExists(table, x, y)) {
|
|
2634
|
-
opts.colSpan++;
|
|
2635
|
-
x++;
|
|
2636
|
-
}
|
|
2637
|
-
let y2 = y + 1;
|
|
2638
|
-
while (y2 < h_max && allBlank(table, y2, opts.x, opts.x + opts.colSpan)) {
|
|
2639
|
-
opts.rowSpan++;
|
|
2640
|
-
y2++;
|
|
2641
|
-
}
|
|
2642
|
-
let cell = new Cell(opts);
|
|
2643
|
-
cell.x = opts.x;
|
|
2644
|
-
cell.y = opts.y;
|
|
2645
|
-
warn(`Missing cell at ${cell.y}-${cell.x}.`);
|
|
2646
|
-
insertCell(cell, table[y]);
|
|
2647
|
-
}
|
|
2648
|
-
}
|
|
2649
|
-
function generateCells(rows) {
|
|
2650
|
-
return rows.map(function(row) {
|
|
2651
|
-
if (!Array.isArray(row)) {
|
|
2652
|
-
let key = Object.keys(row)[0];
|
|
2653
|
-
row = row[key];
|
|
2654
|
-
if (Array.isArray(row)) {
|
|
2655
|
-
row = row.slice();
|
|
2656
|
-
row.unshift(key);
|
|
2657
|
-
} else row = [key, row];
|
|
2658
|
-
}
|
|
2659
|
-
return row.map(function(cell) {
|
|
2660
|
-
return new Cell(cell);
|
|
2661
|
-
});
|
|
2662
|
-
});
|
|
2663
|
-
}
|
|
2664
|
-
function makeTableLayout(rows) {
|
|
2665
|
-
let cellRows = generateCells(rows);
|
|
2666
|
-
layoutTable(cellRows);
|
|
2667
|
-
fillInTable(cellRows);
|
|
2668
|
-
addRowSpanCells(cellRows);
|
|
2669
|
-
addColSpanCells(cellRows);
|
|
2670
|
-
return cellRows;
|
|
2671
|
-
}
|
|
2672
|
-
module.exports = {
|
|
2673
|
-
makeTableLayout,
|
|
2674
|
-
layoutTable,
|
|
2675
|
-
addRowSpanCells,
|
|
2676
|
-
maxWidth,
|
|
2677
|
-
fillInTable,
|
|
2678
|
-
computeWidths: makeComputeWidths("colSpan", "desiredWidth", "x", 1),
|
|
2679
|
-
computeHeights: makeComputeWidths("rowSpan", "desiredHeight", "y", 1)
|
|
1167
|
+
isColorSupported: enabled,
|
|
1168
|
+
reset: f("\x1B[0m", "\x1B[0m"),
|
|
1169
|
+
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
1170
|
+
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
1171
|
+
italic: f("\x1B[3m", "\x1B[23m"),
|
|
1172
|
+
underline: f("\x1B[4m", "\x1B[24m"),
|
|
1173
|
+
inverse: f("\x1B[7m", "\x1B[27m"),
|
|
1174
|
+
hidden: f("\x1B[8m", "\x1B[28m"),
|
|
1175
|
+
strikethrough: f("\x1B[9m", "\x1B[29m"),
|
|
1176
|
+
black: f("\x1B[30m", "\x1B[39m"),
|
|
1177
|
+
red: f("\x1B[31m", "\x1B[39m"),
|
|
1178
|
+
green: f("\x1B[32m", "\x1B[39m"),
|
|
1179
|
+
yellow: f("\x1B[33m", "\x1B[39m"),
|
|
1180
|
+
blue: f("\x1B[34m", "\x1B[39m"),
|
|
1181
|
+
magenta: f("\x1B[35m", "\x1B[39m"),
|
|
1182
|
+
cyan: f("\x1B[36m", "\x1B[39m"),
|
|
1183
|
+
white: f("\x1B[37m", "\x1B[39m"),
|
|
1184
|
+
gray: f("\x1B[90m", "\x1B[39m"),
|
|
1185
|
+
bgBlack: f("\x1B[40m", "\x1B[49m"),
|
|
1186
|
+
bgRed: f("\x1B[41m", "\x1B[49m"),
|
|
1187
|
+
bgGreen: f("\x1B[42m", "\x1B[49m"),
|
|
1188
|
+
bgYellow: f("\x1B[43m", "\x1B[49m"),
|
|
1189
|
+
bgBlue: f("\x1B[44m", "\x1B[49m"),
|
|
1190
|
+
bgMagenta: f("\x1B[45m", "\x1B[49m"),
|
|
1191
|
+
bgCyan: f("\x1B[46m", "\x1B[49m"),
|
|
1192
|
+
bgWhite: f("\x1B[47m", "\x1B[49m"),
|
|
1193
|
+
blackBright: f("\x1B[90m", "\x1B[39m"),
|
|
1194
|
+
redBright: f("\x1B[91m", "\x1B[39m"),
|
|
1195
|
+
greenBright: f("\x1B[92m", "\x1B[39m"),
|
|
1196
|
+
yellowBright: f("\x1B[93m", "\x1B[39m"),
|
|
1197
|
+
blueBright: f("\x1B[94m", "\x1B[39m"),
|
|
1198
|
+
magentaBright: f("\x1B[95m", "\x1B[39m"),
|
|
1199
|
+
cyanBright: f("\x1B[96m", "\x1B[39m"),
|
|
1200
|
+
whiteBright: f("\x1B[97m", "\x1B[39m"),
|
|
1201
|
+
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
|
|
1202
|
+
bgRedBright: f("\x1B[101m", "\x1B[49m"),
|
|
1203
|
+
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
|
|
1204
|
+
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
|
|
1205
|
+
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
|
|
1206
|
+
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
|
|
1207
|
+
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
|
|
1208
|
+
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
2680
1209
|
};
|
|
2681
|
-
})();
|
|
2682
|
-
function makeComputeWidths(colSpan, desiredWidth, x, forcedMin) {
|
|
2683
|
-
return function(vals, table) {
|
|
2684
|
-
let result = [];
|
|
2685
|
-
let spanners = [];
|
|
2686
|
-
let auto = {};
|
|
2687
|
-
table.forEach(function(row) {
|
|
2688
|
-
row.forEach(function(cell) {
|
|
2689
|
-
if ((cell[colSpan] || 1) > 1) spanners.push(cell);
|
|
2690
|
-
else result[cell[x]] = Math.max(result[cell[x]] || 0, cell[desiredWidth] || 0, forcedMin);
|
|
2691
|
-
});
|
|
2692
|
-
});
|
|
2693
|
-
vals.forEach(function(val, index) {
|
|
2694
|
-
if (typeof val === "number") result[index] = val;
|
|
2695
|
-
});
|
|
2696
|
-
for (let k = spanners.length - 1; k >= 0; k--) {
|
|
2697
|
-
let cell = spanners[k];
|
|
2698
|
-
let span = cell[colSpan];
|
|
2699
|
-
let col = cell[x];
|
|
2700
|
-
let existingWidth = result[col];
|
|
2701
|
-
let editableCols = typeof vals[col] === "number" ? 0 : 1;
|
|
2702
|
-
if (typeof existingWidth === "number") for (let i = 1; i < span; i++) {
|
|
2703
|
-
existingWidth += 1 + result[col + i];
|
|
2704
|
-
if (typeof vals[col + i] !== "number") editableCols++;
|
|
2705
|
-
}
|
|
2706
|
-
else {
|
|
2707
|
-
existingWidth = desiredWidth === "desiredWidth" ? cell.desiredWidth - 1 : 1;
|
|
2708
|
-
if (!auto[col] || auto[col] < existingWidth) auto[col] = existingWidth;
|
|
2709
|
-
}
|
|
2710
|
-
if (cell[desiredWidth] > existingWidth) {
|
|
2711
|
-
let i = 0;
|
|
2712
|
-
while (editableCols > 0 && cell[desiredWidth] > existingWidth) {
|
|
2713
|
-
if (typeof vals[col + i] !== "number") {
|
|
2714
|
-
let dif = Math.round((cell[desiredWidth] - existingWidth) / editableCols);
|
|
2715
|
-
existingWidth += dif;
|
|
2716
|
-
result[col + i] += dif;
|
|
2717
|
-
editableCols--;
|
|
2718
|
-
}
|
|
2719
|
-
i++;
|
|
2720
|
-
}
|
|
2721
|
-
}
|
|
2722
|
-
}
|
|
2723
|
-
Object.assign(vals, result, auto);
|
|
2724
|
-
for (let j = 0; j < vals.length; j++) vals[j] = Math.max(forcedMin, vals[j] || 0);
|
|
2725
|
-
};
|
|
2726
|
-
}
|
|
2727
|
-
} });
|
|
2728
|
-
|
|
2729
|
-
//#endregion
|
|
2730
|
-
//#region node_modules/cli-table3/src/table.js
|
|
2731
|
-
var require_table = __commonJS({ "node_modules/cli-table3/src/table.js"(exports, module) {
|
|
2732
|
-
const debug = require_debug$1();
|
|
2733
|
-
const utils = require_utils();
|
|
2734
|
-
const tableLayout = require_layout_manager();
|
|
2735
|
-
var Table$3 = class extends Array {
|
|
2736
|
-
constructor(opts) {
|
|
2737
|
-
super();
|
|
2738
|
-
const options = utils.mergeOptions(opts);
|
|
2739
|
-
Object.defineProperty(this, "options", {
|
|
2740
|
-
value: options,
|
|
2741
|
-
enumerable: options.debug
|
|
2742
|
-
});
|
|
2743
|
-
if (options.debug) {
|
|
2744
|
-
switch (typeof options.debug) {
|
|
2745
|
-
case "boolean":
|
|
2746
|
-
debug.setDebugLevel(debug.WARN);
|
|
2747
|
-
break;
|
|
2748
|
-
case "number":
|
|
2749
|
-
debug.setDebugLevel(options.debug);
|
|
2750
|
-
break;
|
|
2751
|
-
case "string":
|
|
2752
|
-
debug.setDebugLevel(parseInt(options.debug, 10));
|
|
2753
|
-
break;
|
|
2754
|
-
default:
|
|
2755
|
-
debug.setDebugLevel(debug.WARN);
|
|
2756
|
-
debug.warn(`Debug option is expected to be boolean, number, or string. Received a ${typeof options.debug}`);
|
|
2757
|
-
}
|
|
2758
|
-
Object.defineProperty(this, "messages", { get() {
|
|
2759
|
-
return debug.debugMessages();
|
|
2760
|
-
} });
|
|
2761
|
-
}
|
|
2762
|
-
}
|
|
2763
|
-
toString() {
|
|
2764
|
-
let array = this;
|
|
2765
|
-
let headersPresent = this.options.head && this.options.head.length;
|
|
2766
|
-
if (headersPresent) {
|
|
2767
|
-
array = [this.options.head];
|
|
2768
|
-
if (this.length) array.push.apply(array, this);
|
|
2769
|
-
} else this.options.style.head = [];
|
|
2770
|
-
let cells = tableLayout.makeTableLayout(array);
|
|
2771
|
-
cells.forEach(function(row) {
|
|
2772
|
-
row.forEach(function(cell) {
|
|
2773
|
-
cell.mergeTableOptions(this.options, cells);
|
|
2774
|
-
}, this);
|
|
2775
|
-
}, this);
|
|
2776
|
-
tableLayout.computeWidths(this.options.colWidths, cells);
|
|
2777
|
-
tableLayout.computeHeights(this.options.rowHeights, cells);
|
|
2778
|
-
cells.forEach(function(row) {
|
|
2779
|
-
row.forEach(function(cell) {
|
|
2780
|
-
cell.init(this.options);
|
|
2781
|
-
}, this);
|
|
2782
|
-
}, this);
|
|
2783
|
-
let result = [];
|
|
2784
|
-
for (let rowIndex = 0; rowIndex < cells.length; rowIndex++) {
|
|
2785
|
-
let row = cells[rowIndex];
|
|
2786
|
-
let heightOfRow = this.options.rowHeights[rowIndex];
|
|
2787
|
-
if (rowIndex === 0 || !this.options.style.compact || rowIndex == 1 && headersPresent) doDraw(row, "top", result);
|
|
2788
|
-
for (let lineNum = 0; lineNum < heightOfRow; lineNum++) doDraw(row, lineNum, result);
|
|
2789
|
-
if (rowIndex + 1 == cells.length) doDraw(row, "bottom", result);
|
|
2790
|
-
}
|
|
2791
|
-
return result.join("\n");
|
|
2792
|
-
}
|
|
2793
|
-
get width() {
|
|
2794
|
-
let str = this.toString().split("\n");
|
|
2795
|
-
return str[0].length;
|
|
2796
|
-
}
|
|
2797
1210
|
};
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
let line = [];
|
|
2801
|
-
row.forEach(function(cell) {
|
|
2802
|
-
line.push(cell.draw(lineNum));
|
|
2803
|
-
});
|
|
2804
|
-
let str = line.join("");
|
|
2805
|
-
if (str.length) result.push(str);
|
|
2806
|
-
}
|
|
2807
|
-
module.exports = Table$3;
|
|
2808
|
-
} });
|
|
2809
|
-
|
|
2810
|
-
//#endregion
|
|
2811
|
-
//#region node_modules/cli-table3/index.js
|
|
2812
|
-
var require_cli_table3 = __commonJS({ "node_modules/cli-table3/index.js"(exports, module) {
|
|
2813
|
-
module.exports = require_table();
|
|
1211
|
+
module.exports = createColors();
|
|
1212
|
+
module.exports.createColors = createColors;
|
|
2814
1213
|
} });
|
|
2815
1214
|
|
|
2816
1215
|
//#endregion
|
|
@@ -2833,12 +1232,6 @@ const sharedArgs = {
|
|
|
2833
1232
|
description: "Filter until date (YYYYMMDD format)",
|
|
2834
1233
|
parse: parseDateArg
|
|
2835
1234
|
},
|
|
2836
|
-
path: {
|
|
2837
|
-
type: "string",
|
|
2838
|
-
short: "p",
|
|
2839
|
-
description: "Custom path to Claude data directory",
|
|
2840
|
-
default: getDefaultClaudePath()
|
|
2841
|
-
},
|
|
2842
1235
|
json: {
|
|
2843
1236
|
type: "boolean",
|
|
2844
1237
|
short: "j",
|
|
@@ -2875,6 +1268,13 @@ const sharedArgs = {
|
|
|
2875
1268
|
short: "b",
|
|
2876
1269
|
description: "Show per-model cost breakdown",
|
|
2877
1270
|
default: false
|
|
1271
|
+
},
|
|
1272
|
+
offline: {
|
|
1273
|
+
type: "boolean",
|
|
1274
|
+
negatable: true,
|
|
1275
|
+
short: "O",
|
|
1276
|
+
description: "Use cached data instead of fetching from API",
|
|
1277
|
+
default: false
|
|
2878
1278
|
}
|
|
2879
1279
|
};
|
|
2880
1280
|
const sharedCommandConfig = {
|
|
@@ -2882,9 +1282,45 @@ const sharedCommandConfig = {
|
|
|
2882
1282
|
toKebab: true
|
|
2883
1283
|
};
|
|
2884
1284
|
|
|
1285
|
+
//#endregion
|
|
1286
|
+
//#region src/utils.internal.ts
|
|
1287
|
+
var import_picocolors$3 = __toESM(require_picocolors(), 1);
|
|
1288
|
+
function formatNumber(num) {
|
|
1289
|
+
return num.toLocaleString("en-US");
|
|
1290
|
+
}
|
|
1291
|
+
function formatCurrency(amount) {
|
|
1292
|
+
return `$${amount.toFixed(2)}`;
|
|
1293
|
+
}
|
|
1294
|
+
function formatModelName(modelName) {
|
|
1295
|
+
const match = modelName.match(/claude-(\w+)-(\d+)-\d+/);
|
|
1296
|
+
if (match != null) return `${match[1]}-${match[2]}`;
|
|
1297
|
+
return modelName;
|
|
1298
|
+
}
|
|
1299
|
+
function formatModelsDisplay(models) {
|
|
1300
|
+
const uniqueModels = [...new Set(models.map(formatModelName))];
|
|
1301
|
+
return uniqueModels.sort().join(", ");
|
|
1302
|
+
}
|
|
1303
|
+
/**
|
|
1304
|
+
* Pushes model breakdown rows to a table
|
|
1305
|
+
* @param table - The table to push rows to
|
|
1306
|
+
* @param table.push - Method to add rows to the table
|
|
1307
|
+
* @param breakdowns - Array of model breakdowns
|
|
1308
|
+
* @param extraColumns - Number of extra empty columns before the data (default: 1 for models column)
|
|
1309
|
+
* @param trailingColumns - Number of extra empty columns after the data (default: 0)
|
|
1310
|
+
*/
|
|
1311
|
+
function pushBreakdownRows(table, breakdowns, extraColumns = 1, trailingColumns = 0) {
|
|
1312
|
+
for (const breakdown of breakdowns) {
|
|
1313
|
+
const row = [` └─ ${formatModelName(breakdown.modelName)}`];
|
|
1314
|
+
for (let i = 0; i < extraColumns; i++) row.push("");
|
|
1315
|
+
const totalTokens = breakdown.inputTokens + breakdown.outputTokens + breakdown.cacheCreationTokens + breakdown.cacheReadTokens;
|
|
1316
|
+
row.push(import_picocolors$3.default.gray(formatNumber(breakdown.inputTokens)), import_picocolors$3.default.gray(formatNumber(breakdown.outputTokens)), import_picocolors$3.default.gray(formatNumber(breakdown.cacheCreationTokens)), import_picocolors$3.default.gray(formatNumber(breakdown.cacheReadTokens)), import_picocolors$3.default.gray(formatNumber(totalTokens)), import_picocolors$3.default.gray(formatCurrency(breakdown.cost)));
|
|
1317
|
+
for (let i = 0; i < trailingColumns; i++) row.push("");
|
|
1318
|
+
table.push(row);
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
|
|
2885
1322
|
//#endregion
|
|
2886
1323
|
//#region src/commands/daily.ts
|
|
2887
|
-
var import_cli_table3$2 = __toESM(require_cli_table3(), 1);
|
|
2888
1324
|
var import_picocolors$2 = __toESM(require_picocolors(), 1);
|
|
2889
1325
|
const dailyCommand = define({
|
|
2890
1326
|
name: "daily",
|
|
@@ -2895,9 +1331,10 @@ const dailyCommand = define({
|
|
|
2895
1331
|
const dailyData = await loadDailyUsageData({
|
|
2896
1332
|
since: ctx.values.since,
|
|
2897
1333
|
until: ctx.values.until,
|
|
2898
|
-
claudePath:
|
|
1334
|
+
claudePath: getDefaultClaudePath(),
|
|
2899
1335
|
mode: ctx.values.mode,
|
|
2900
|
-
order: ctx.values.order
|
|
1336
|
+
order: ctx.values.order,
|
|
1337
|
+
offline: ctx.values.offline
|
|
2901
1338
|
});
|
|
2902
1339
|
if (dailyData.length === 0) {
|
|
2903
1340
|
if (ctx.values.json) log(JSON.stringify([]));
|
|
@@ -2906,7 +1343,7 @@ const dailyCommand = define({
|
|
|
2906
1343
|
}
|
|
2907
1344
|
const totals = calculateTotals(dailyData);
|
|
2908
1345
|
if (ctx.values.debug && !ctx.values.json) {
|
|
2909
|
-
const mismatchStats = await detectMismatches(
|
|
1346
|
+
const mismatchStats = await detectMismatches(getDefaultClaudePath());
|
|
2910
1347
|
printMismatchReport(mismatchStats, ctx.values.debugSamples);
|
|
2911
1348
|
}
|
|
2912
1349
|
if (ctx.values.json) {
|
|
@@ -2927,7 +1364,7 @@ const dailyCommand = define({
|
|
|
2927
1364
|
log(JSON.stringify(jsonOutput, null, 2));
|
|
2928
1365
|
} else {
|
|
2929
1366
|
logger.box("Claude Code Token Usage Report - Daily");
|
|
2930
|
-
const table = new
|
|
1367
|
+
const table = new ResponsiveTable({
|
|
2931
1368
|
head: [
|
|
2932
1369
|
"Date",
|
|
2933
1370
|
"Models",
|
|
@@ -2948,7 +1385,8 @@ const dailyCommand = define({
|
|
|
2948
1385
|
"right",
|
|
2949
1386
|
"right",
|
|
2950
1387
|
"right"
|
|
2951
|
-
]
|
|
1388
|
+
],
|
|
1389
|
+
dateFormatter: formatDateCompact
|
|
2952
1390
|
});
|
|
2953
1391
|
for (const data of dailyData) {
|
|
2954
1392
|
table.push([
|
|
@@ -2964,14 +1402,14 @@ const dailyCommand = define({
|
|
|
2964
1402
|
if (ctx.values.breakdown) pushBreakdownRows(table, data.modelBreakdowns);
|
|
2965
1403
|
}
|
|
2966
1404
|
table.push([
|
|
2967
|
-
"
|
|
2968
|
-
"
|
|
2969
|
-
"
|
|
2970
|
-
"
|
|
2971
|
-
"
|
|
2972
|
-
"
|
|
2973
|
-
"
|
|
2974
|
-
"
|
|
1405
|
+
"",
|
|
1406
|
+
"",
|
|
1407
|
+
"",
|
|
1408
|
+
"",
|
|
1409
|
+
"",
|
|
1410
|
+
"",
|
|
1411
|
+
"",
|
|
1412
|
+
""
|
|
2975
1413
|
]);
|
|
2976
1414
|
table.push([
|
|
2977
1415
|
import_picocolors$2.default.yellow("Total"),
|
|
@@ -2994,7 +1432,6 @@ const mcpCommand = define({
|
|
|
2994
1432
|
name: "mcp",
|
|
2995
1433
|
description: "Show usage report for MCP",
|
|
2996
1434
|
args: {
|
|
2997
|
-
path: sharedArgs.path,
|
|
2998
1435
|
mode: sharedArgs.mode,
|
|
2999
1436
|
type: {
|
|
3000
1437
|
type: "enum",
|
|
@@ -3010,10 +1447,10 @@ const mcpCommand = define({
|
|
|
3010
1447
|
}
|
|
3011
1448
|
},
|
|
3012
1449
|
async run(ctx) {
|
|
3013
|
-
const { type, mode,
|
|
1450
|
+
const { type, mode, port } = ctx.values;
|
|
3014
1451
|
if (type === "stdio") logger.level = 0;
|
|
3015
1452
|
const server = createMcpServer({
|
|
3016
|
-
claudePath:
|
|
1453
|
+
claudePath: getDefaultClaudePath(),
|
|
3017
1454
|
mode
|
|
3018
1455
|
});
|
|
3019
1456
|
await server.start(ctx.values.type === "http" ? {
|
|
@@ -3025,7 +1462,6 @@ const mcpCommand = define({
|
|
|
3025
1462
|
|
|
3026
1463
|
//#endregion
|
|
3027
1464
|
//#region src/commands/monthly.ts
|
|
3028
|
-
var import_cli_table3$1 = __toESM(require_cli_table3(), 1);
|
|
3029
1465
|
var import_picocolors$1 = __toESM(require_picocolors(), 1);
|
|
3030
1466
|
const monthlyCommand = define({
|
|
3031
1467
|
name: "monthly",
|
|
@@ -3036,9 +1472,10 @@ const monthlyCommand = define({
|
|
|
3036
1472
|
const monthlyData = await loadMonthlyUsageData({
|
|
3037
1473
|
since: ctx.values.since,
|
|
3038
1474
|
until: ctx.values.until,
|
|
3039
|
-
claudePath:
|
|
1475
|
+
claudePath: getDefaultClaudePath(),
|
|
3040
1476
|
mode: ctx.values.mode,
|
|
3041
|
-
order: ctx.values.order
|
|
1477
|
+
order: ctx.values.order,
|
|
1478
|
+
offline: ctx.values.offline
|
|
3042
1479
|
});
|
|
3043
1480
|
if (monthlyData.length === 0) {
|
|
3044
1481
|
if (ctx.values.json) {
|
|
@@ -3059,7 +1496,7 @@ const monthlyCommand = define({
|
|
|
3059
1496
|
}
|
|
3060
1497
|
const totals = calculateTotals(monthlyData);
|
|
3061
1498
|
if (ctx.values.debug && !ctx.values.json) {
|
|
3062
|
-
const mismatchStats = await detectMismatches(
|
|
1499
|
+
const mismatchStats = await detectMismatches(getDefaultClaudePath());
|
|
3063
1500
|
printMismatchReport(mismatchStats, ctx.values.debugSamples);
|
|
3064
1501
|
}
|
|
3065
1502
|
if (ctx.values.json) {
|
|
@@ -3080,7 +1517,7 @@ const monthlyCommand = define({
|
|
|
3080
1517
|
log(JSON.stringify(jsonOutput, null, 2));
|
|
3081
1518
|
} else {
|
|
3082
1519
|
logger.box("Claude Code Token Usage Report - Monthly");
|
|
3083
|
-
const table = new
|
|
1520
|
+
const table = new ResponsiveTable({
|
|
3084
1521
|
head: [
|
|
3085
1522
|
"Month",
|
|
3086
1523
|
"Models",
|
|
@@ -3101,7 +1538,8 @@ const monthlyCommand = define({
|
|
|
3101
1538
|
"right",
|
|
3102
1539
|
"right",
|
|
3103
1540
|
"right"
|
|
3104
|
-
]
|
|
1541
|
+
],
|
|
1542
|
+
dateFormatter: formatDateCompact
|
|
3105
1543
|
});
|
|
3106
1544
|
for (const data of monthlyData) {
|
|
3107
1545
|
table.push([
|
|
@@ -3117,14 +1555,14 @@ const monthlyCommand = define({
|
|
|
3117
1555
|
if (ctx.values.breakdown) pushBreakdownRows(table, data.modelBreakdowns);
|
|
3118
1556
|
}
|
|
3119
1557
|
table.push([
|
|
3120
|
-
"
|
|
3121
|
-
"
|
|
3122
|
-
"
|
|
3123
|
-
"
|
|
3124
|
-
"
|
|
3125
|
-
"
|
|
3126
|
-
"
|
|
3127
|
-
"
|
|
1558
|
+
"",
|
|
1559
|
+
"",
|
|
1560
|
+
"",
|
|
1561
|
+
"",
|
|
1562
|
+
"",
|
|
1563
|
+
"",
|
|
1564
|
+
"",
|
|
1565
|
+
""
|
|
3128
1566
|
]);
|
|
3129
1567
|
table.push([
|
|
3130
1568
|
import_picocolors$1.default.yellow("Total"),
|
|
@@ -3143,7 +1581,6 @@ const monthlyCommand = define({
|
|
|
3143
1581
|
|
|
3144
1582
|
//#endregion
|
|
3145
1583
|
//#region src/commands/session.ts
|
|
3146
|
-
var import_cli_table3 = __toESM(require_cli_table3(), 1);
|
|
3147
1584
|
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
3148
1585
|
const sessionCommand = define({
|
|
3149
1586
|
name: "session",
|
|
@@ -3154,9 +1591,10 @@ const sessionCommand = define({
|
|
|
3154
1591
|
const sessionData = await loadSessionData({
|
|
3155
1592
|
since: ctx.values.since,
|
|
3156
1593
|
until: ctx.values.until,
|
|
3157
|
-
claudePath:
|
|
1594
|
+
claudePath: getDefaultClaudePath(),
|
|
3158
1595
|
mode: ctx.values.mode,
|
|
3159
|
-
order: ctx.values.order
|
|
1596
|
+
order: ctx.values.order,
|
|
1597
|
+
offline: ctx.values.offline
|
|
3160
1598
|
});
|
|
3161
1599
|
if (sessionData.length === 0) {
|
|
3162
1600
|
if (ctx.values.json) log(JSON.stringify([]));
|
|
@@ -3165,7 +1603,7 @@ const sessionCommand = define({
|
|
|
3165
1603
|
}
|
|
3166
1604
|
const totals = calculateTotals(sessionData);
|
|
3167
1605
|
if (ctx.values.debug && !ctx.values.json) {
|
|
3168
|
-
const mismatchStats = await detectMismatches(
|
|
1606
|
+
const mismatchStats = await detectMismatches(getDefaultClaudePath());
|
|
3169
1607
|
printMismatchReport(mismatchStats, ctx.values.debugSamples);
|
|
3170
1608
|
}
|
|
3171
1609
|
if (ctx.values.json) {
|
|
@@ -3187,7 +1625,7 @@ const sessionCommand = define({
|
|
|
3187
1625
|
log(JSON.stringify(jsonOutput, null, 2));
|
|
3188
1626
|
} else {
|
|
3189
1627
|
logger.box("Claude Code Token Usage Report - By Session");
|
|
3190
|
-
const table = new
|
|
1628
|
+
const table = new ResponsiveTable({
|
|
3191
1629
|
head: [
|
|
3192
1630
|
"Session",
|
|
3193
1631
|
"Models",
|
|
@@ -3210,7 +1648,8 @@ const sessionCommand = define({
|
|
|
3210
1648
|
"right",
|
|
3211
1649
|
"right",
|
|
3212
1650
|
"left"
|
|
3213
|
-
]
|
|
1651
|
+
],
|
|
1652
|
+
dateFormatter: formatDateCompact
|
|
3214
1653
|
});
|
|
3215
1654
|
let maxSessionLength = 0;
|
|
3216
1655
|
for (const data of sessionData) {
|
|
@@ -3230,15 +1669,15 @@ const sessionCommand = define({
|
|
|
3230
1669
|
if (ctx.values.breakdown) pushBreakdownRows(table, data.modelBreakdowns, 1, 1);
|
|
3231
1670
|
}
|
|
3232
1671
|
table.push([
|
|
3233
|
-
"
|
|
3234
|
-
"
|
|
3235
|
-
"
|
|
3236
|
-
"
|
|
3237
|
-
"
|
|
3238
|
-
"
|
|
3239
|
-
"
|
|
3240
|
-
"
|
|
3241
|
-
"
|
|
1672
|
+
"",
|
|
1673
|
+
"",
|
|
1674
|
+
"",
|
|
1675
|
+
"",
|
|
1676
|
+
"",
|
|
1677
|
+
"",
|
|
1678
|
+
"",
|
|
1679
|
+
"",
|
|
1680
|
+
""
|
|
3242
1681
|
]);
|
|
3243
1682
|
table.push([
|
|
3244
1683
|
import_picocolors.default.yellow("Total"),
|