refactor(main): extract password-store args, mpv plugin detection, yomitan anki sync, session bindings, log export from main.ts

This commit is contained in:
2026-06-11 22:52:34 -07:00
parent 2d1b6cb78e
commit 1a3944aa4f
6 changed files with 407 additions and 265 deletions
+36
View File
@@ -0,0 +1,36 @@
export function getPasswordStoreArg(argv: string[]): string | null {
let resolved: string | null = null;
for (let i = 0; i < argv.length; i += 1) {
const arg = argv[i];
if (!arg?.startsWith('--password-store')) {
continue;
}
if (arg === '--password-store') {
const value = argv[i + 1];
if (value && !value.startsWith('--')) {
resolved = value.trim();
i += 1;
}
continue;
}
const [prefix, value] = arg.split('=', 2);
if (prefix === '--password-store' && value && value.trim().length > 0) {
resolved = value.trim();
}
}
return resolved;
}
export function normalizePasswordStoreArg(value: string): string {
const normalized = value.trim();
if (normalized.toLowerCase() === 'gnome') {
return 'gnome-libsecret';
}
return normalized;
}
export function getDefaultPasswordStore(): string {
return 'gnome-libsecret';
}