windingwind c48e085b8d fix: build async bug
fix: eslint esm bug
2023-05-07 01:43:04 +08:00

29 lines
779 B
JavaScript

import process from "process";
import { execSync } from "child_process";
import { exit } from "process";
import minimist from "minimist";
import cmd from "./zotero-cmd.json" assert { type: "json" };
const { exec } = cmd;
// Run node start.js -h for help
const args = minimist(process.argv.slice(2));
if (args.help || args.h) {
console.log("Start Zotero Args:");
console.log(
"--zotero(-z): Zotero exec key in zotero-cmd.json. Default the first one."
);
console.log("--profile(-p): Zotero profile name.");
exit(0);
}
const zoteroPath = exec[args.zotero || args.z || Object.keys(exec)[0]];
const profile = args.profile || args.p;
const startZotero = `${zoteroPath} --debugger --purgecaches ${
profile ? `-p ${profile}` : ""
}`;
execSync(startZotero);
exit(0);