From df713f4ce90254662a6f2db4abf15bdcdb40b0cf Mon Sep 17 00:00:00 2001 From: worm Date: Mon, 2 Jan 2023 13:32:33 -0800 Subject: [PATCH] implement check to verify a run id was provided --- log | 0 main.js | 14 ++++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 log diff --git a/log b/log new file mode 100644 index 0000000..e69de29 diff --git a/main.js b/main.js index 9d65ee7..fe86e70 100644 --- a/main.js +++ b/main.js @@ -3,10 +3,16 @@ import { get_run_details } from "./tfc-api-functions.mjs"; const my_config = normalized_config; -// console.log(my_config); +const runid_provided = run_id => { + return (run_id ? true : false); +} -console.log(process.argv.slice(2)); +const runidNotProvided = run_id => { + return !runid_provided(run_id); +} -const response = await get_run_details(my_config.base_url, process.argv.slice(2), my_config.token); +if(runidNotProvided(process.argv[2])){ + throw new Error("RunID must be provided"); +} -//console.log(response); \ No newline at end of file +const response = await get_run_details(my_config.base_url, process.argv.slice(2), my_config.token); \ No newline at end of file