feat(cli): 支持大输出防爆保护、本地文件转储与敏感凭证全链路脱敏并发布 v0.4.2
🚀 Release / 🚀 Build & Publish Multi-Platform Binaries (push) Has been cancelled

This commit is contained in:
gitea committed 2026-09-03 11:40:32 +08:00
1 parent cf44c7dcdf
commit ba30c1a6cb
16 files changed
+251 -51

No files matched your search

+24 -2
View File
@@ -1,4 +1,4 @@
import type { CliParsedArgs } from "./types.js";
import type { CliParsedArgs, OutputOptions } from "./types.js";
const KNOWN_BOOLEAN_FLAGS = new Set([
"raw",
@@ -19,6 +19,10 @@ const KNOWN_BOOLEAN_FLAGS = new Set([
"local",
"workspace",
"external",
"full",
"allow-full",
"allowFull",
"summary",
]);
export function parseArgs(rawArgs: string[]): CliParsedArgs {
@@ -61,7 +65,17 @@ export function parseArgs(rawArgs: string[]): CliParsedArgs {
if (flag === "h") options.help = true;
else if (flag === "j") options.json = true;
else if (flag === "v") options.version = true;
else options[flag] = true;
else if (flag === "o") {
const next = rawArgs[i + 1];
if (next && !next.startsWith("-")) {
options.outputFile = next;
i++;
} else {
options.o = true;
}
} else {
options[flag] = true;
}
continue;
}
@@ -121,3 +135,11 @@ export function numberOption(
}
return fallback;
}
export function outputOptions(options: Record<string, unknown>): OutputOptions {
return {
allowFull: booleanOption(options, ["full", "allow-full", "allowFull"]),
outputFile: stringOption(options, ["output-file", "outputFile", "o"]),
summary: booleanOption(options, ["summary"]),
};
}