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.
This commit is contained in:
Sandro642 2024-10-27 10:57:28 +01:00
parent f68165c66f
commit 040ca971e8
2 changed files with 13 additions and 7 deletions

View File

@ -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

View File

@ -1,5 +1,5 @@
{
"extraFileVerifActivated": false,
"menuVisibility": "visible",
"debug": "false"
}
"extraFileVerifActivated": false,
"menuVisibility": "visible",
"debug": false
}