mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-02-27 18:22:41 -08:00
refactor(cli): remove deprecated verbose logging flags
This commit is contained in:
@@ -1,71 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
usage() {
|
||||
cat <<'EOF'
|
||||
Usage:
|
||||
./scripts/check-main-lines.sh [target-lines] [file]
|
||||
./scripts/check-main-lines.sh --target <target-lines> --file <path>
|
||||
|
||||
target-lines default: 1500
|
||||
file default: src/main.ts
|
||||
EOF
|
||||
}
|
||||
|
||||
target="1500"
|
||||
file="src/main.ts"
|
||||
|
||||
if (($# == 1)) && [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
||||
usage
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ $# -ge 1 && "$1" != --* ]]; then
|
||||
target="$1"
|
||||
if [[ $# -ge 2 ]]; then
|
||||
file="$2"
|
||||
fi
|
||||
shift $(($# > 1 ? 2 : 1))
|
||||
fi
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--target)
|
||||
target="$2"
|
||||
shift 2
|
||||
;;
|
||||
--file)
|
||||
file="$2"
|
||||
shift 2
|
||||
;;
|
||||
--help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "[ERROR] Unknown argument: $1" >&2
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ ! -f "$file" ]]; then
|
||||
echo "[ERROR] File not found: $file" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! [[ "$target" =~ ^[0-9]+$ ]]; then
|
||||
echo "[ERROR] Target line count must be an integer. Got: $target" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
actual="$(wc -l <"$file" | tr -d ' ')"
|
||||
|
||||
echo "[INFO] $file lines: $actual (target: <= $target)"
|
||||
if ((actual > target)); then
|
||||
echo "[ERROR] Line gate failed: $actual > $target" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "[OK] Line gate passed"
|
||||
@@ -11,7 +11,7 @@ interface CliOptions {
|
||||
input: string;
|
||||
dictionaryPath: string;
|
||||
emitPretty: boolean;
|
||||
emitVerbose: boolean;
|
||||
emitDiagnostics: boolean;
|
||||
mecabCommand?: string;
|
||||
mecabDictionaryPath?: string;
|
||||
forceMecabOnly?: boolean;
|
||||
@@ -35,7 +35,7 @@ function parseCliArgs(argv: string[]): CliOptions {
|
||||
let inputParts: string[] = [];
|
||||
let dictionaryPath = path.join(process.cwd(), "vendor", "jiten_freq_global");
|
||||
let emitPretty = false;
|
||||
let emitVerbose = false;
|
||||
let emitDiagnostics = false;
|
||||
let mecabCommand: string | undefined;
|
||||
let mecabDictionaryPath: string | undefined;
|
||||
let forceMecabOnly = false;
|
||||
@@ -307,8 +307,8 @@ function parseCliArgs(argv: string[]): CliOptions {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (arg === "--verbose") {
|
||||
emitVerbose = true;
|
||||
if (arg === "--diagnostics") {
|
||||
emitDiagnostics = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -336,7 +336,7 @@ function parseCliArgs(argv: string[]): CliOptions {
|
||||
input: stdin,
|
||||
dictionaryPath,
|
||||
emitPretty,
|
||||
emitVerbose,
|
||||
emitDiagnostics,
|
||||
forceMecabOnly,
|
||||
yomitanExtensionPath,
|
||||
yomitanUserDataPath,
|
||||
@@ -360,7 +360,7 @@ function parseCliArgs(argv: string[]): CliOptions {
|
||||
input,
|
||||
dictionaryPath,
|
||||
emitPretty,
|
||||
emitVerbose,
|
||||
emitDiagnostics,
|
||||
forceMecabOnly,
|
||||
yomitanExtensionPath,
|
||||
yomitanUserDataPath,
|
||||
@@ -382,10 +382,10 @@ function parseCliArgs(argv: string[]): CliOptions {
|
||||
|
||||
function printUsage(): void {
|
||||
process.stdout.write(`Usage:
|
||||
pnpm run get-frequency [--pretty] [--verbose] [--dictionary <path>] [--mecab-command <path>] [--mecab-dictionary <path>] <text>
|
||||
pnpm run get-frequency [--pretty] [--diagnostics] [--dictionary <path>] [--mecab-command <path>] [--mecab-dictionary <path>] <text>
|
||||
|
||||
--pretty Pretty-print JSON output.
|
||||
--verbose Include merged-frequency diagnostics and lookup term details.
|
||||
--diagnostics Include merged-frequency lookup-term details.
|
||||
--force-mecab Skip Yomitan parser initialization and force MeCab fallback.
|
||||
--yomitan-extension <path> Optional path to a Yomitan extension directory.
|
||||
--yomitan-user-data <path> Optional Electron userData directory for Yomitan state.
|
||||
@@ -828,7 +828,7 @@ async function main(): Promise<void> {
|
||||
const mergedCount = subtitleData.tokens?.filter((token) => token.isMerged).length ?? 0;
|
||||
const tokens =
|
||||
subtitleData.tokens?.map((token) =>
|
||||
args.emitVerbose
|
||||
args.emitDiagnostics
|
||||
? simplifyTokenWithVerbose(token, getFrequencyRank)
|
||||
: simplifyToken(token),
|
||||
) ?? null;
|
||||
|
||||
Reference in New Issue
Block a user