From 8cfdaddd7aa1042c7fff34d8248b54367eed6f4b Mon Sep 17 00:00:00 2001 From: Vyacheslav Matyukhin Date: Sun, 27 Mar 2022 01:48:44 +0300 Subject: [PATCH] feat: cli exits properly; disable excessive db logging --- src/backend/database/pg-wrapper.js | 2 +- src/backend/index.ts | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/backend/database/pg-wrapper.js b/src/backend/database/pg-wrapper.js index af86e56..76c59ac 100644 --- a/src/backend/database/pg-wrapper.js +++ b/src/backend/database/pg-wrapper.js @@ -64,7 +64,7 @@ export const runPgCommand = async ({ command, pool }) => { let result; try { let response = await client.query(command); - console.log(response); + // console.log(response); result = { results: response ? response.rows : null }; } catch (error) { console.log(error); diff --git a/src/backend/index.ts b/src/backend/index.ts index 2034509..c6ded7e 100644 --- a/src/backend/index.ts +++ b/src/backend/index.ts @@ -23,7 +23,6 @@ let functions = [ pgInitialize, rebuildFrontpage, ]; -let functionNames = functions.map((fun) => fun.name); let generateWhatToDoMessage = () => { let l = platformFetchers.length; @@ -68,13 +67,13 @@ let commandLineUtility = async () => { let executeoption = async (option) => { option = Number(option); - //console.log(functionNames[option]) if (option < 0) { - console.log(`Error, ${option} < 0 or ${option} < 0`); + console.log(`Error, ${option} < 0`); } else if (option < functions.length) { console.log(`Running: ${functions[option].name}\n`); await tryCatchTryAgain(functions[option]); } + process.exit(); }; if (process.argv.length == 3) { @@ -83,14 +82,11 @@ let commandLineUtility = async () => { if (!isNaN(optionNum)) { await executeoption(optionNum); } else if (option == "all") { - await executeoption(functions.length - 1); // 15 = execute all fetchers + await executeoption(functions.length - 3); // doEverything } else { await whattodo(whattodoMessage, executeoption); } } else await whattodo(whattodoMessage, executeoption); }; -// console.log("1") -// console.log(process.argv) commandLineUtility(); -// doEverything()