mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-03-06 19:57:26 -08:00
feat: add AniList character dictionary sync
This commit is contained in:
31
launcher/commands/dictionary-command.ts
Normal file
31
launcher/commands/dictionary-command.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { runAppCommandWithInherit } from '../mpv.js';
|
||||
import type { LauncherCommandContext } from './context.js';
|
||||
|
||||
interface DictionaryCommandDeps {
|
||||
runAppCommandWithInherit: (appPath: string, appArgs: string[]) => never;
|
||||
}
|
||||
|
||||
const defaultDeps: DictionaryCommandDeps = {
|
||||
runAppCommandWithInherit,
|
||||
};
|
||||
|
||||
export function runDictionaryCommand(
|
||||
context: LauncherCommandContext,
|
||||
deps: DictionaryCommandDeps = defaultDeps,
|
||||
): boolean {
|
||||
const { args, appPath } = context;
|
||||
if (!args.dictionary || !appPath) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const forwarded = ['--dictionary'];
|
||||
if (typeof args.dictionaryTarget === 'string' && args.dictionaryTarget.trim()) {
|
||||
forwarded.push('--dictionary-target', args.dictionaryTarget);
|
||||
}
|
||||
if (args.logLevel !== 'info') {
|
||||
forwarded.push('--log-level', args.logLevel);
|
||||
}
|
||||
|
||||
deps.runAppCommandWithInherit(appPath, forwarded);
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user