@hi18n/cli
Version:
Message internationalization meets immutability and type-safety - command line tool
34 lines • 1.15 kB
JavaScript
import { Command } from "commander";
import { export_ } from "./export.js";
import { sync } from "./sync.js";
export async function hi18n(argv, cwd = process.cwd(), output, overrideExit) {
const program = new Command();
program.name("hi18n").description("CLI for managing translations with hi18n");
if (output)
program.configureOutput(output);
if (overrideExit)
program.exitOverride();
program
.command("sync")
.description("Synchronize translation ids")
.argument("[files...]")
.option("--exclude <files...>")
.option("-c, --check", "report errors if one or more files would be changed")
.action(syncCommand);
program.command("export").description("export data").action(exportCommand);
async function syncCommand(files, options) {
await sync({
cwd,
include: files,
exclude: options.exclude,
checkOnly: options.check,
});
}
async function exportCommand() {
await export_({
cwd,
});
}
await program.parseAsync(argv);
}
//# sourceMappingURL=command.js.map