From 040ca971e8d3ad1ba0ae5752a80c9dac9bdc56e6 Mon Sep 17 00:00:00 2001 From: Sandro642 Date: Sun, 27 Oct 2024 10:57:28 +0100 Subject: [PATCH] Refactor CLI activation logic and improve debug capabilities This commit refactors the code in extraverif.js to improve the activation logic for the extra file verification CLI. It now handles comment lines correctly and ignores them. Additionally, the debug capabilities have been enhanced. The landing script has also been updated to improve debug capabilities. Unnecessary comment separators have been removed. --- app/assets/extraverif/extraverif.js | 12 +++++++++--- app/assets/extraverif/variables.json | 8 ++++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/app/assets/extraverif/extraverif.js b/app/assets/extraverif/extraverif.js index 5f285b3b..1c313bf0 100644 --- a/app/assets/extraverif/extraverif.js +++ b/app/assets/extraverif/extraverif.js @@ -23,8 +23,11 @@ function startCLI() { const config = loadConfig() rl.question('Would you like to activate extra file verification? (yes/no): ', (answer) => { + if (answer.trim().startsWith('//')) { + console.log('This is a comment; the line is ignored.') rl.close() return + } if (answer.toLowerCase() === 'yes') { config.extraFileVerifActivated = true @@ -33,15 +36,18 @@ function startCLI() { config.debug = debugAnswer.toLowerCase() === 'yes' rl.question('Would you like to hide or block the menu? (hide/block): ', (menuAnswer) => { + if (menuAnswer.trim().startsWith('//')) { + console.log('This is a comment; the line is ignored.') rl.close() return + } if (menuAnswer.toLowerCase() === 'hide') { config.menuVisibility = 'hidden' - console.log('Extra file verification is activated. Menu hidden.') + console.log('Extra file verification activated. Menu hidden.') } else if (menuAnswer.toLowerCase() === 'block') { config.menuVisibility = 'blocked' - console.log('Extra file verification is activated. Menu blocked.') + console.log('Extra file verification activated. Menu blocked.') } else { console.log('Invalid option for the menu.') rl.close() @@ -53,7 +59,7 @@ function startCLI() { }) }) } else if (answer.toLowerCase() === 'no') { - console.log('Extra file verification is not activated. Closing the CLI.') + console.log('Extra file verification not activated. Closing the CLI.') config.extraFileVerifActivated = false config.menuVisibility = 'visible' config.debug = false diff --git a/app/assets/extraverif/variables.json b/app/assets/extraverif/variables.json index 42cd8264..a8c88e0e 100644 --- a/app/assets/extraverif/variables.json +++ b/app/assets/extraverif/variables.json @@ -1,5 +1,5 @@ { - "extraFileVerifActivated": false, - "menuVisibility": "visible", - "debug": "false" -} + "extraFileVerifActivated": false, + "menuVisibility": "visible", + "debug": false +} \ No newline at end of file