mirror of
https://github.com/zkldi/Tachi.git
synced 2026-09-30 19:07:58 +03:00
Tidy up validate-database script to take arguments
This commit is contained in:
@@ -6,6 +6,14 @@ import { FormatPrError } from "utils/prudence";
|
||||
// note: a hell of a lot of this code is copy pasted
|
||||
// this is just a script, so, feel free to refactor it.
|
||||
|
||||
import { Command } from "commander";
|
||||
|
||||
const program = new Command();
|
||||
program.option("-c, --collection <collectionName>");
|
||||
|
||||
program.parse(process.argv);
|
||||
const options = program.opts();
|
||||
|
||||
const logger = CreateLogCtx(__filename);
|
||||
|
||||
export async function ValidateCollection(collectionName: Databases): Promise<void> {
|
||||
@@ -44,5 +52,8 @@ export async function ValidateAllCollections() {
|
||||
}
|
||||
|
||||
if (require.main === module) {
|
||||
if (options.collection) {
|
||||
ValidateCollection(options.collection).then(() => process.exit(0));
|
||||
}
|
||||
ValidateAllCollections().then(() => process.exit(0));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user