hunspell-reader
Version:
A library for reading Hunspell Dictionary Files
26 lines • 1.05 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCommand = void 0;
// cSpell:ignore findup
const commander_1 = require("commander");
const affReader_1 = require("./affReader");
const affToDicInfo_1 = require("./affToDicInfo");
const textUtils_1 = require("./textUtils");
function getCommand() {
const commander = new commander_1.Command('cspell-dict-info');
commander
.arguments('<hunspell_aff_file> <locale>')
.description('Display the CSpell Dictionary Information')
.action(action);
return commander;
}
exports.getCommand = getCommand;
async function action(hunspellFile, locale) {
const baseFile = hunspellFile.replace(/\.(dic|aff)$/, '');
const affFile = baseFile + '.aff';
const aff = await (0, affReader_1.parseAffFile)(affFile);
const info = (0, affToDicInfo_1.affToDicInfo)(aff, locale);
const rawJson = JSON.stringify(info, null, 2);
console.log((0, textUtils_1.escapeUnicodeCode)(rawJson));
}
//# sourceMappingURL=commandDictInfo.js.map