mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-02-28 06:22:45 -08:00
feat: add manual known-word cache refresh path
- Add CLI command flag with non-GUI dispatch flow and OSD error handling. - Add runtime integration call and IPC hook so manual refresh works from command runner without app startup. - Add public AnkiIntegration manual refresh API with force refresh semantics and guard reuse. - Preserve default n+1 behavior by fixing config validation for malformed values and adding tests.
This commit is contained in:
@@ -41,4 +41,9 @@ test("hasExplicitCommand and shouldStartApp preserve command intent", () => {
|
||||
const noCommand = parseArgs(["--verbose"]);
|
||||
assert.equal(hasExplicitCommand(noCommand), false);
|
||||
assert.equal(shouldStartApp(noCommand), false);
|
||||
|
||||
const refreshKnownWords = parseArgs(["--refresh-known-words"]);
|
||||
assert.equal(refreshKnownWords.help, false);
|
||||
assert.equal(hasExplicitCommand(refreshKnownWords), true);
|
||||
assert.equal(shouldStartApp(refreshKnownWords), false);
|
||||
});
|
||||
|
||||
@@ -16,6 +16,7 @@ export interface CliArgs {
|
||||
mineSentence: boolean;
|
||||
mineSentenceMultiple: boolean;
|
||||
updateLastCardFromClipboard: boolean;
|
||||
refreshKnownWords: boolean;
|
||||
toggleSecondarySub: boolean;
|
||||
triggerFieldGrouping: boolean;
|
||||
triggerSubsync: boolean;
|
||||
@@ -55,6 +56,7 @@ export function parseArgs(argv: string[]): CliArgs {
|
||||
mineSentence: false,
|
||||
mineSentenceMultiple: false,
|
||||
updateLastCardFromClipboard: false,
|
||||
refreshKnownWords: false,
|
||||
toggleSecondarySub: false,
|
||||
triggerFieldGrouping: false,
|
||||
triggerSubsync: false,
|
||||
@@ -100,6 +102,7 @@ export function parseArgs(argv: string[]): CliArgs {
|
||||
else if (arg === "--mine-sentence-multiple") args.mineSentenceMultiple = true;
|
||||
else if (arg === "--update-last-card-from-clipboard")
|
||||
args.updateLastCardFromClipboard = true;
|
||||
else if (arg === "--refresh-known-words") args.refreshKnownWords = true;
|
||||
else if (arg === "--toggle-secondary-sub") args.toggleSecondarySub = true;
|
||||
else if (arg === "--trigger-field-grouping")
|
||||
args.triggerFieldGrouping = true;
|
||||
@@ -181,6 +184,7 @@ export function hasExplicitCommand(args: CliArgs): boolean {
|
||||
args.mineSentence ||
|
||||
args.mineSentenceMultiple ||
|
||||
args.updateLastCardFromClipboard ||
|
||||
args.refreshKnownWords ||
|
||||
args.toggleSecondarySub ||
|
||||
args.triggerFieldGrouping ||
|
||||
args.triggerSubsync ||
|
||||
|
||||
@@ -17,4 +17,5 @@ test("printHelp includes configured texthooker port", () => {
|
||||
|
||||
assert.match(output, /--help\s+Show this help/);
|
||||
assert.match(output, /default: 7777/);
|
||||
assert.match(output, /--refresh-known-words/);
|
||||
});
|
||||
|
||||
@@ -18,8 +18,9 @@ SubMiner CLI commands:
|
||||
--copy-subtitle-multiple Start multi-copy mode
|
||||
--mine-sentence Mine sentence card from current subtitle
|
||||
--mine-sentence-multiple Start multi-mine sentence mode
|
||||
--update-last-card-from-clipboard Update last card from clipboard
|
||||
--toggle-secondary-sub Cycle secondary subtitle mode
|
||||
--update-last-card-from-clipboard Update last card from clipboard
|
||||
--refresh-known-words Refresh known words cache now
|
||||
--toggle-secondary-sub Cycle secondary subtitle mode
|
||||
--trigger-field-grouping Trigger Kiku field grouping
|
||||
--trigger-subsync Run subtitle sync
|
||||
--mark-audio-card Mark last card as audio card
|
||||
|
||||
Reference in New Issue
Block a user