diff --git a/index.js b/index.js index 47b03bd..a3cc7b7 100644 --- a/index.js +++ b/index.js @@ -22,16 +22,13 @@ const config_file = process.argv.slice(2)[0] 'File not specified as start param. Please inform the filename with its extension as --file in start script.' ); -// Defining txt as default value. -let export_opt = 'xlsx'; +let export_opt = process.argv.slice(2)[1] || "xlsx"; // Checking command line params for export option -if (process.argv.slice(2)[1] === 'xlsx') { - export_opt = process.argv.slice(2)[1]; -} else if (process.argv.slice(2)[1] === 'pdf') { - export_opt = process.argv.slice(2)[1]; -} else { - new Error('Export type not specified as start param. Please inform how you wish to export the results.'); +if ((!(export_opt === 'xlsx' || export_opt === 'txt'))) { + console.log(new Error('Export type not specified as start param. Please inform how you wish to export the results.')); + // For now, we can only export in xlsx and txt, but later on we'll be able to export in pdf. Therefore, we'll leave this code line as is. + return; } // Defining export extension based on export option extracted from command line params.