From de4d4e044324f70ed91bc8b093f114b7841df772 Mon Sep 17 00:00:00 2001 From: zkldi Date: Fri, 22 Oct 2021 01:41:03 +0100 Subject: [PATCH] Tidy up validate-database script to take arguments --- server/scripts/validate-database.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/server/scripts/validate-database.ts b/server/scripts/validate-database.ts index 8ff0ea809..0fa42f07c 100644 --- a/server/scripts/validate-database.ts +++ b/server/scripts/validate-database.ts @@ -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 "); + +program.parse(process.argv); +const options = program.opts(); + const logger = CreateLogCtx(__filename); export async function ValidateCollection(collectionName: Databases): Promise { @@ -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)); }