mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-07-29 19:21:33 -07:00
32 lines
754 B
TypeScript
32 lines
754 B
TypeScript
import * as path from 'path';
|
|
|
|
function redactSkippedYomitanWriteValue(
|
|
actionName:
|
|
| 'importYomitanDictionary'
|
|
| 'deleteYomitanDictionary'
|
|
| 'upsertYomitanDictionarySettings',
|
|
rawValue: string,
|
|
): string {
|
|
const trimmed = rawValue.trim();
|
|
if (!trimmed) {
|
|
return '<redacted>';
|
|
}
|
|
|
|
if (actionName === 'importYomitanDictionary') {
|
|
const basename = path.basename(trimmed);
|
|
return basename || '<redacted>';
|
|
}
|
|
|
|
return '<redacted>';
|
|
}
|
|
|
|
export function formatSkippedYomitanWriteAction(
|
|
actionName:
|
|
| 'importYomitanDictionary'
|
|
| 'deleteYomitanDictionary'
|
|
| 'upsertYomitanDictionarySettings',
|
|
rawValue: string,
|
|
): string {
|
|
return `${actionName}(${redactSkippedYomitanWriteValue(actionName, rawValue)})`;
|
|
}
|