in sqlite/src/main.ts [68:120]
export async function run(this: void, options: Options): Promise<void> {
if (options.help) {
return;
}
if (options.version) {
console.log(require('../package.json').version);
return;
}
if (!options.stdin && options.in === undefined) {
console.error(`Either a input file using --in or --stdin must be specified.`);
process.exitCode = -1;
return;
}
if (!options.stdout && options.out === undefined) {
console.error(`Either a output file using --out or --stdout must be specified.`);
process.exitCode = -1;
return;
}
if (options.stdout && !options.compressOnly) {
console.error(`Writing to stdout can only be used together with --compressOnly`);
process.exitCode = -1;
return;
}
if (options.mode !== 'create' && options.mode !== 'import') {
console.error(`Valid mode values are either 'create' or 'import'.`);
process.exitCode = -1;
return;
}
if (options.mode === 'import' && options.format === 'blob') {
console.error(`Import mode is only valid when using graph format.`);
process.exitCode = -1;
return;
}
try {
await execute(options);
} catch (error) {
if (error instanceof RunError) {
console.error(error.message);
process.exitCode = error.exitCode;
return;
} else {
throw error;
}
}
}