diff --git a/db/blockly_unix_database.db b/db/blockly_unix_database.db index f18fde6..679e523 100644 Binary files a/db/blockly_unix_database.db and b/db/blockly_unix_database.db differ diff --git a/public/blocks/lnBlock.js b/public/blocks/lnBlock.js index e33a965..b8b6a2a 100644 --- a/public/blocks/lnBlock.js +++ b/public/blocks/lnBlock.js @@ -54,27 +54,7 @@ var lnBlock = { ], style: 'Filesystem Operations', tooltip: '%{BKY_LN_TOOLTIP}', - helpUrl: 'https://linux.die.net/man/1/ln', - generateCommand: function (block) { - let lnCommand = 'ln '; - const symbolic = block.getFieldValue('symbolic') === 'TRUE'; - const force = block.getFieldValue('force') === 'TRUE'; - const interactive = block.getFieldValue('interactive') === 'TRUE'; - - if (symbolic) lnCommand += ' -s '; - if (force) lnCommand += ' -f '; - if (interactive) lnCommand += ' -i '; - - const sourceArgsBlock = block.getInputTargetBlock('SOURCE'); - const targetArgsBlock = block.getInputTargetBlock('TARGET'); - lnCommand += - handleArgumentsBlocks(sourceArgsBlock) + - ' ' + - handleArgumentsBlocks(targetArgsBlock); - - generatedCommand = lnCommand; - return generatedCommand; - } + helpUrl: 'https://linux.die.net/man/1/ln' }; Blockly.defineBlocksWithJsonArray([lnBlock]); diff --git a/public/blocks/mvBlock.js b/public/blocks/mvBlock.js index 5074d0b..49026d5 100644 --- a/public/blocks/mvBlock.js +++ b/public/blocks/mvBlock.js @@ -48,34 +48,7 @@ var mvBlock = { ], style: 'Filesystem Operations', tooltip: 'Μετακινεί ή μετονομάζει αρχεία.', - helpUrl: 'https://linux.die.net/man/1/mv', - - generateCommand: function (block) { - let mvCommand = 'mv '; // Start the mv command - - // Handle options - const notPromptConfirmation = - block.getFieldValue('not_prompt_confirmation') === 'TRUE'; - const promptConfirmation = - block.getFieldValue('prompt_confirmation') === 'TRUE'; - const notOverwrite = block.getFieldValue('not_overwrite') === 'TRUE'; - - if (notPromptConfirmation) mvCommand += '-f '; // Add -f for no prompt - if (promptConfirmation) mvCommand += '-i '; // Add -i for prompt - if (notOverwrite) mvCommand += '-n '; // Add -n for no overwrite - - // Get source and destination blocks - const sourceArgsBlock = block.getInputTargetBlock('SOURCE'); - const targetArgsBlock = block.getInputTargetBlock('DEST'); - - // Append arguments (source and destination paths) - mvCommand += - handleArgumentsBlocks(sourceArgsBlock) + - ' ' + - handleArgumentsBlocks(targetArgsBlock); - - return mvCommand; // Return the generated mv command - } + helpUrl: 'https://linux.die.net/man/1/mv' }; Blockly.defineBlocksWithJsonArray([mvBlock]); diff --git a/public/blocks/rmBlock.js b/public/blocks/rmBlock.js index 6de0d1e..b5192b4 100644 --- a/public/blocks/rmBlock.js +++ b/public/blocks/rmBlock.js @@ -53,27 +53,7 @@ var rmBlock = { extensions: [], style: 'Filesystem Operations', tooltip: '%{BKY_RM_TOOLTIP}', - helpUrl: 'https://linux.die.net/man/1/rm', - - generateCommand: function (block) { - let rmCommand = 'rm '; - const force = block.getFieldValue('force') === 'TRUE'; - const requestConfirmation = - block.getFieldValue('request_confirmation') === 'TRUE'; - const removeDirectory = block.getFieldValue('remove_directory') === 'TRUE'; - const recursive = block.getFieldValue('recursive') === 'TRUE'; - - if (force) rmCommand += '-f '; - if (requestConfirmation) rmCommand += '-i '; - if (removeDirectory) rmCommand += '-d '; - if (recursive) rmCommand += '-R '; - - const argumentBlock = block.getInputTargetBlock('ARGUMENT'); - rmCommand += ' ' + handleArgumentsBlocks(argumentBlock); - - generatedCommand = rmCommand; - return generatedCommand; - } + helpUrl: 'https://linux.die.net/man/1/rm' }; Blockly.defineBlocksWithJsonArray([rmBlock]); diff --git a/public/js/block.js b/public/js/block.js index 7223f2e..9689f42 100644 --- a/public/js/block.js +++ b/public/js/block.js @@ -16,7 +16,9 @@ function generateCommandFromWorkspace() { var blockDef = window[currentBlock.type + 'Block']; const specificCommand = handleSpecificBlocks(currentBlock); try { - if ( + if (filenameBlocks.includes(currentBlock.type)) { + console.log('Filename Block initiated'); + } else if ( blockDef && (blockDef.category === 'I/O Redirection' || blockDef.category === 'Regular Expressions') @@ -30,10 +32,6 @@ function generateCommandFromWorkspace() { } } catch (error) { console.error('An error occurred:', error.message); - if (error.lineNumber) { - console.log('Line Number:', error.lineNumber); - } - console.error(error.stack); break; } currentBlock = currentBlock.getNextBlock();