Skip to content

Commit

Permalink
Add blocks for mv, rm and touch commands
Browse files Browse the repository at this point in the history
  • Loading branch information
simosathan9 committed Sep 11, 2024
1 parent 8505642 commit 9896ab6
Show file tree
Hide file tree
Showing 6 changed files with 411 additions and 23 deletions.
40 changes: 37 additions & 3 deletions public/blocks/mvBlock.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
var mvBlock = {
type: 'mv',
category: 'File and Directory Operations',
message0: 'mv %1 %2',
message0: 'Move %1 to %2', // Correctly references %1 (SOURCE) and %2 (DEST)
unix_description: [
{
command: 'mv %SOURCE %DEST'
not_prompt_confirmation: '-f',
prompt_confirmation: '-i',
verbose: '-v',
not_overwrite: '-n'
}
],
args0: [
Expand All @@ -19,6 +22,38 @@ var mvBlock = {
text: 'dest' // default destination
}
],
message1: '%{BKY_MV_NOT_PROMPT_CONFIRMATION}',
args1: [
{
type: 'field_checkbox',
name: 'not_prompt_confirmation',
checked: false
}
],
message2: '%{BKY_MV_PROMPT_CONFIRMATION}',
args2: [
{
type: 'field_checkbox',
name: 'prompt_confirmation',
checked: false
}
],
message3: '%{BKY_MV_VERBOSE}',
args3: [
{
type: 'field_checkbox',
name: 'verbose',
checked: false
}
],
message4: '%{BKY_MV_NOT_OVERWRITE}',
args4: [
{
type: 'field_checkbox',
name: 'not_overwrite',
checked: false
}
],
style: 'File and Directory Operations',
previousStatement: 'Action',
nextStatement: 'Action',
Expand All @@ -27,4 +62,3 @@ var mvBlock = {
};

Blockly.defineBlocksWithJsonArray([mvBlock]);
//
62 changes: 50 additions & 12 deletions public/blocks/rmBlock.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,72 @@
var rmBlock = {
type: 'rm',
message0: '%{BKY_RM}',
category: 'File and Directory Operations',
message1: 'remove %1',
unix_description: [
{
command: 'rm %FILE',
request_confirmation: '-i'
force: '-f',
request_confirmation: '-i',
remove_directory: '-d',
recursive: '-R',
verbose: '-v',
undelete: '-W',
no_cross_mount: '-x'
}
],
message0: '%{BKY_RM_REQUEST_CONFIRMATION}',
args0: [
message1: '%{BKY_RM_FORCE}',
args1: [
{
type: 'field_checkbox',
name: 'force',
checked: false
}
],
message2: '%{BKY_RM_REQUEST_CONFIRMATION}',
args2: [
{
type: 'field_checkbox',
name: 'request_confirmation',
checked: false // by default it's disabled
checked: false
}
],
args1: [
message3: '%{BKY_RM_REMOVE_DIRECTORIES}',
args3: [
{
type: 'field_checkbox',
name: 'remove_directory',
checked: false
}
],
message4: '%{BKY_RM_RECURSIVE}',
args4: [
{
type: 'field_input',
name: 'FILE',
text: 'file' // default file
type: 'field_checkbox',
name: 'recursive',
checked: false
}
],
message5: '%{BKY_RM_VERBOSE}',
args5: [
{
type: 'field_checkbox',
name: 'verbose',
checked: false
}
],
message6: '%{BKY_RM_NO_CROSS_MOUNT}',
args6: [
{
type: 'field_checkbox',
name: 'no_cross_mount',
checked: false
}
],
extensions: [],
style: 'File and Directory Operations',
previousStatement: 'Action',
nextStatement: 'Action',
tooltip: 'Διαγράφει αρχεία και καταλόγους.',
tooltip: '%{BKY_RM_TOOLTIP}',
helpUrl: 'https://linux.die.net/man/1/rm'
};

Blockly.defineBlocksWithJsonArray([rmBlock]);
//
57 changes: 55 additions & 2 deletions public/blocks/touchBlock.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,61 @@
var touchBlock = {
type: 'touch',
category: 'File and Directory Operations',
unix_description: [{}],
message0: '%{BKY_TOUCH}',
category: 'File and Directory Operations',
unix_description: [
{
not_create_file: '-c',
change_time_t: '-t str',
change_time_d: '-d str',
access_time: '-a',
modification_time: '-r'
}
],
message1: '%{BKY_TOUCH_NOT_CREATE_FILE}',
args1: [
{
type: 'field_checkbox',
name: 'not_create_file',
checked: false
}
],
message2: '%{BKY_TOUCH_CHANGE_ACCESS_TIME}',
args2: [
{
type: 'field_checkbox',
name: 'access_time',
checked: false
}
],
message3: '%{BKY_TOUCH_CHANGE_MODIFICATION_TIME}',
args3: [
{
type: 'field_checkbox',
name: 'modification_time',
checked: false
}
],

message4: '%{BKY_TOUCH_SPECIFY_TIME_FORMAT_T}',
args4: [
{
type: 'field_input',
name: 'change_time_t',
text: '',
check: 'String'
}
],
message5: '%{BKY_TOUCH_PROPOSE_OTHER_FORMAT}',
message6: '%{BKY_TOUCH_SPECIFY_TIME_FORMAT_D}',
args6: [
{
type: 'field_input',
name: 'change_time_d',
text: '',
check: 'String'
}
],
extensions: ['validate_touch_time_t', 'validate_touch_time_d'],
style: 'File and Directory Operations',
previousStatement: 'Action',
nextStatement: 'Action',
Expand Down
35 changes: 32 additions & 3 deletions public/js/el.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ Blockly.Msg['MKDIR_WRITE_DIRECTORY'] = 'Γράψτε όνομα καταλόγο
Blockly.Msg['MKDIR_TOOLTIP'] = 'Δημιουργία καταλόγου';
Blockly.Msg['MKDIR_HELPURL'] = 'https://www.google.com/';

Blockly.Msg['MV_NOT_PROMPT_CONFIRMATION'] = 'Μην ζητήσεις επιβεβαίωση %1';
Blockly.Msg['MV_PROMPT_CONFIRMATION'] =
'Ζήτα επιβεβαίωση προτού εκτελέστεί η εντολή %1';
Blockly.Msg['MV_VERBOSE'] = 'Λεπτομερής αναφορά %1';
Blockly.Msg['MV_NOT_OVERWRITE'] = 'Μη αντικατάσταση αρχείου %1';

Blockly.Msg['RECORD_NUMBER'] = 'Τρέχων εγγραφή';
Blockly.Msg['RECORD_NUMBER_TOOLTIP'] =
'Αντιπροσωπεύει τον τρέχοντα αριθμό εγγραφής (γραμμής)';
Expand Down Expand Up @@ -592,7 +598,18 @@ Blockly.Msg['REMOVE_COMMENT'] = 'Αφαίρεση σχολίου';
Blockly.Msg['RENAME_VARIABLE'] = 'Μετονομασία μεταβλητής...';
Blockly.Msg['RENAME_VARIABLE_TITLE'] =
"Μετονομασία όλων των μεταβλητών '%1' σε:";
Blockly.Msg['RM_REQUEST_CONFIRMATION'] = 'Αίτημα επιβεβαίωσης για αφαίρεση %1';
Blockly.Msg['RM'] = 'Αφαίρεση αρχείου(ων)';
Blockly.Msg['RM_FORCE'] = 'Επιβολή αφαίρεσης χωρίς επιβεβαίωση %1';
Blockly.Msg['RM_REQUEST_CONFIRMATION'] =
'Ζητήστε επιβεβαίωση πριν την αφαίρεση αρχείου(ων) %1';
Blockly.Msg['RM_REMOVE_DIRECTORIES'] = 'Αφαίρεση καταλόγων %1';
Blockly.Msg['RM_RECURSIVE'] = 'Αφαίρεση αναδρομικά %1';
Blockly.Msg['RM_VERBOSE'] =
'Λειτουργία αναλυτικών πληροφοριών (εμφάνιση αφαιρεθέντων αρχείων) %1';
Blockly.Msg['RM_NO_CROSS_MOUNT'] = 'Μην διασχίσετε σημεία σύνδεσης %1';
Blockly.Msg['RM_TOOLTIP'] =
'Αφαιρεί αρχεία και καταλόγους με βάση τις καθορισμένες επιλογές.';

Blockly.Msg['TEXT_APPEND_HELPURL'] =
'https://github.com/google/blockly/wiki/Text#text-modification';
Blockly.Msg['TEXT_APPEND_TITLE'] = 'στο %1 προσθήκη κειμένου %2';
Expand Down Expand Up @@ -850,8 +867,20 @@ Blockly.Msg['TEE_TOOLTIP'] =
'Το εργαλείο tee αντιγράφει την τυπική είσοδο στην τυπική έξοδο, κάνοντας ένα αντίγραφο σε ένα ή περισσότερα αρχεία.';
Blockly.Msg['TEE_HELPURL'] = 'https://www.google.com/';

Blockly.Msg['TOUCH'] = 'Δημιουργία αρχείου';
Blockly.Msg['TOUCH_TOOLTIP'] = 'δημιουργία καταλόγου';
Blockly.Msg['TOUCH'] = 'Τροποποίηση χρονικών στιγμών αρχείου';
Blockly.Msg['TOUCH_NOT_CREATE_FILE'] =
'Μη δημιουργία αρχείου αν δεν υπάρχει %1';
Blockly.Msg['TOUCH_CHANGE_ACCESS_TIME'] =
'Αλλαγή χρόνου τελευταίας πρόσβασης %1';
Blockly.Msg['TOUCH_CHANGE_MODIFICATION_TIME'] =
'Αλλαγή χρόνου τελευταίας τροποποίησης %1';
Blockly.Msg['TOUCH_SPECIFY_TIME_FORMAT_T'] =
'με προσθήκη ημερομηνίας στη μορφή [[CC]YY]MMDDhhmm[.SS] %1';
Blockly.Msg['TOUCH_PROPOSE_OTHER_FORMAT'] = 'ή';
Blockly.Msg['TOUCH_SPECIFY_TIME_FORMAT_D'] =
'με προσθήκη ημερομηνίας στη μορφή YYYY-MM-DDThh:mm:SS[.frac][Z (για UTC)] %1';
Blockly.Msg['TOUCH_TOOLTIP'] =
'Όρισε την ώρα πρόσβασης και τροποποίησης ενός αρχείου. Αν το αρχείο δεν υπάρχει, δημιούργησε ένα κενό αρχείο.';
Blockly.Msg['TOUCH_HELPURL'] = 'https://www.google.com/';

Blockly.Msg['UNIQ'] = 'Αφαίρεση διπλότυπων γραμμών στο αρχείο\n';
Expand Down
29 changes: 26 additions & 3 deletions public/js/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ Blockly.Msg['MKDIR_WRITE_DIRECTORY'] = 'Write directory or path %1';
Blockly.Msg['MKDIR_TOOLTIP'] = 'Create directory';
Blockly.Msg['MKDIR_HELPURL'] = 'https://www.google.com/';

Blockly.Msg['MV_NOT_PROMPT_CONFIRMATION'] = 'Do not prompt for confirmation %1';
Blockly.Msg['MV_PROMPT_CONFIRMATION'] = 'Prompt for confirmation %1';
Blockly.Msg['MV_VERBOSE'] = 'Verbose mode %1';
Blockly.Msg['MV_NOT_OVERWRITE'] = 'Do not overwrite %1';

Blockly.Msg['RECORD_NUMBER'] = 'Current record';
Blockly.Msg['RECORD_NUMBER_TOOLTIP'] =
'Represents the current record or (line) number';
Expand Down Expand Up @@ -580,8 +585,16 @@ Blockly.Msg['REGOR_CREATE_WITH'] = 'multiple patterns';
Blockly.Msg['REMOVE_COMMENT'] = 'Remove Comment';
Blockly.Msg['RENAME_VARIABLE'] = 'Rename variable...';
Blockly.Msg['RENAME_VARIABLE_TITLE'] = "Rename all '%1' variables to:";
Blockly.Msg['RM'] = 'Remove file(s)';
Blockly.Msg['RM_FORCE'] = 'Force removal without prompt %1';
Blockly.Msg['RM_REQUEST_CONFIRMATION'] =
'Request confirmation before deleting %1';
'Request confirmation before removing file(s) %1';
Blockly.Msg['RM_REMOVE_DIRECTORIES'] = 'Remove directories %1';
Blockly.Msg['RM_RECURSIVE'] = 'Remove recursively %1';
Blockly.Msg['RM_VERBOSE'] = 'Verbose mode (show removed files) %1';
Blockly.Msg['RM_NO_CROSS_MOUNT'] = 'Do not cross mount points %1';
Blockly.Msg['RM_TOOLTIP'] =
'Removes files and directories based on specified options.';
Blockly.Msg['TEXT_APPEND_HELPURL'] =
'https://github.com/google/blockly/wiki/Text#text-modification';
Blockly.Msg['TEXT_APPEND_TITLE'] = 'to %1 append text %2';
Expand Down Expand Up @@ -827,8 +840,18 @@ Blockly.Msg['TEE_TOOLTIP'] =
'The tee utility copies standard input to standard output, making a copy in zero or more files.';
Blockly.Msg['TEE_HELPURL'] = 'https://www.google.com/';

Blockly.Msg['TOUCH'] = 'Create a file';
Blockly.Msg['TOUCH_TOOLTIP'] = 'create directory';
Blockly.Msg['TOUCH'] = 'Modify file timestamps';
Blockly.Msg['TOUCH_NOT_CREATE_FILE'] =
'Do not create file if it does not exist %1';
Blockly.Msg['TOUCH_CHANGE_ACCESS_TIME'] = 'Change access time %1';
Blockly.Msg['TOUCH_CHANGE_MODIFICATION_TIME'] = 'Change modification time %1';
Blockly.Msg['TOUCH_SPECIFY_TIME_FORMAT_T'] =
'with date in [[CC]YY]MMDDhhmm[.SS] %1';
Blockly.Msg['TOUCH_PROPOSE_OTHER_FORMAT'] = 'or';
Blockly.Msg['TOUCH_SPECIFY_TIME_FORMAT_D'] =
'with date in YYYY-MM-DDThh:mm:SS[.frac][Z (UTC)] %1';
Blockly.Msg['TOUCH_TOOLTIP'] =
'Set the modification and access times of files. If any file does not exist, it is created with default permissions. ';
Blockly.Msg['TOUCH_HELPURL'] = 'https://www.google.com/';

Blockly.Msg['UNIQ'] = 'Remove duplicate lines in file\n';
Expand Down
Loading

0 comments on commit 9896ab6

Please sign in to comment.