quiver-to-obsidian
Version:
Convert quiver libraray to obsidian library
41 lines • 1.98 kB
JavaScript
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
import { Command } from 'commander';
import chalk from 'chalk';
import Quiver from './quiver/index.js';
import * as fs from 'fs';
const program = new Command();
const { log } = console;
const version = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url)).toString()).version;
program.requiredOption('-q, --quiver-path <path>', 'quiver library dir path')
.requiredOption('-o, --output-path <path>', 'output dir path')
.option('-e, --ext-names [ext...]', '[option] replace some unknown resource image file ext to `png`');
program.showHelpAfterError();
program.version(version, '-v, --version');
program.parse(process.argv);
const options = program.opts();
const { quiverPath } = options;
const { outputPath } = options;
const { extNames } = options;
const execute = () => __awaiter(void 0, void 0, void 0, function* () {
try {
const quiver = yield Quiver.newQuiver(quiverPath, extNames);
const quiverOutput = yield quiver.transformQvLibraryToObsidian(outputPath);
log(chalk.green(`🎉 Finished, please check output path: ${quiverOutput}`));
process.exit(0);
}
catch (error) {
log(chalk.red(`Error: ${error.message}`));
process.exit(1);
}
});
execute();
//# sourceMappingURL=index.js.map