diff --git a/.gitignore b/.gitignore index 8bb97eb..1edd27c 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ node_modules .DS_Store npm-debug.log .env -.history \ No newline at end of file +.history +bin/pre-commit diff --git a/bin/pre-commit b/bin/pre-commit old mode 100755 new mode 100644 index 26980b7..00797b1 --- a/bin/pre-commit +++ b/bin/pre-commit @@ -1,52 +1,52 @@ -#!/bin/sh - -# Run npm run check to perform checks before committing -npm run format-check - -# If npm run check fails (returns non-zero exit code), exit with error -if [ $? -ne 0 ]; then - echo "npm run check failed, aborting commit." - echo "Run 'npm run prettier-fix' to fix formatting issues." - exit 1 -fi - -if git rev-parse --verify HEAD >/dev/null 2>&1 -then - against=HEAD -else - # Initial commit: diff against an empty tree object - against=$(git hash-object -t tree /dev/null) -fi - -# If you want to allow non-ASCII filenames set this variable to true. -allownonascii=$(git config --type=bool hooks.allownonascii) - -# Redirect output to stderr. -exec 1>&2 - -# Cross platform projects tend to avoid non-ASCII filenames; prevent -# them from being added to the repository. We exploit the fact that the -# printable range starts at the space character and ends with tilde. -if [ "$allownonascii" != "true" ] && - # Note that the use of brackets around a tr range is ok here, (it's - # even required, for portability to Solaris 10's /usr/bin/tr), since - # the square bracket bytes happen to fall in the designated range. - test $(git diff --cached --name-only --diff-filter=A -z $against | - LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 -then - cat <<\EOF -Error: Attempt to add a non-ASCII file name. - -This can cause problems if you want to work with people on other platforms. - -To be portable it is advisable to rename the file. - -If you know what you are doing you can disable this check using: - - git config hooks.allownonascii true -EOF - exit 1 -fi - -# If there are whitespace errors, print the offending file names and fail. +#!/bin/sh + +# Run npm run check to perform checks before committing +npm run format-check + +# If npm run check fails (returns non-zero exit code), exit with error +if [ $? -ne 0 ]; then + echo "npm run check failed, aborting commit." + echo "Run 'npm run prettier-fix' to fix formatting issues." + exit 1 +fi + +if git rev-parse --verify HEAD >/dev/null 2>&1 +then + against=HEAD +else + # Initial commit: diff against an empty tree object + against=$(git hash-object -t tree /dev/null) +fi + +# If you want to allow non-ASCII filenames set this variable to true. +allownonascii=$(git config --type=bool hooks.allownonascii) + +# Redirect output to stderr. +exec 1>&2 + +# Cross platform projects tend to avoid non-ASCII filenames; prevent +# them from being added to the repository. We exploit the fact that the +# printable range starts at the space character and ends with tilde. +if [ "$allownonascii" != "true" ] && + # Note that the use of brackets around a tr range is ok here, (it's + # even required, for portability to Solaris 10's /usr/bin/tr), since + # the square bracket bytes happen to fall in the designated range. + test $(git diff --cached --name-only --diff-filter=A -z $against | + LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 +then + cat <<\EOF +Error: Attempt to add a non-ASCII file name. + +This can cause problems if you want to work with people on other platforms. + +To be portable it is advisable to rename the file. + +If you know what you are doing you can disable this check using: + + git config hooks.allownonascii true +EOF + exit 1 +fi + +# If there are whitespace errors, print the offending file names and fail. exec git diff-index --check --cached $against -- \ No newline at end of file diff --git a/db/blockly_unix_database.db b/db/blockly_unix_database.db index 22a2269..13760eb 100644 Binary files a/db/blockly_unix_database.db and b/db/blockly_unix_database.db differ diff --git a/public/blocks/findBlock.js b/public/blocks/findBlock.js index 0f0f487..287f3c2 100644 --- a/public/blocks/findBlock.js +++ b/public/blocks/findBlock.js @@ -22,7 +22,7 @@ var findBlock = { subdirs: '-maxdepth 1', file: '-type f', directory: '-type d', - regPattern: '"patt"', + Pattern: '-regex "str"', both: '' } ], @@ -151,7 +151,7 @@ var findBlock = { args9: [ { type: 'input_statement', - name: 'regPattern', + name: 'Pattern', check: 'String' } ], diff --git a/public/blocks/grepBlock.js b/public/blocks/grepBlock.js index 046a319..181ffb4 100644 --- a/public/blocks/grepBlock.js +++ b/public/blocks/grepBlock.js @@ -12,7 +12,7 @@ var grepBlock = { show_line_nums: '-n', stop_after_num_matches: '-m ', multiple_patterns: '-e', - regPattern: '"patt"', + regPattern: "-E 'patt'", showFiles: '-H', print_context_before_match: '-B ', print_context_after_match: '-A ' diff --git a/public/blocks/regAnyOneBlock.js b/public/blocks/regAnyOneBlock.js index 60bf4bd..73316ba 100644 --- a/public/blocks/regAnyOneBlock.js +++ b/public/blocks/regAnyOneBlock.js @@ -3,17 +3,17 @@ var regAnyOneBlock = { category: 'Regular Expressions', unix_description: [ { - regPattern: '[stm]', - notMatch: '[^stm]' + Pattern: '[patt]', + notMatch: '[^patt]' } ], message0: '%{BKY_REGANYONE} \n %{BKY_REGANYONE_NOT}', args0: [ { - type: 'input_statement', - name: 'regPattern', - check: 'String' + type: 'field_input', + name: 'Pattern', + text: 'String' }, { diff --git a/public/js/block.js b/public/js/block.js index a664ed2..c0fc0ae 100644 --- a/public/js/block.js +++ b/public/js/block.js @@ -197,14 +197,17 @@ function handleMainBlocks( field.getValue() ); } else if (field instanceof Blockly.FieldNumber) { - value = + if ( blockDefinition.unix_description[0][field.name] == null && field.getValue() != 0 - ? field.getValue() - : field.getValue() == 0 - ? '' - : blockDefinition.unix_description[0][field.name] + - field.getValue(); + ) { + value = field.getValue(); + } else if (field.getValue() == 0) { + value = ''; + } else { + value = + blockDefinition.unix_description[0][field.name] + field.getValue(); + } } else if (input.type === Blockly.INPUT_VALUE) { if ( block.getInputTargetBlock(input.name) && @@ -232,7 +235,6 @@ function handleMainBlocks( inputValueStr = getMultiplePrints(inputBlock); if (inputValueStr !== '' && inputValue == null) { inputValue = inputValueStr; - //console.log("handleMainBlocks - after inputValue:", inputValue); } value = diff --git a/views/homePage.ejs b/views/homePage.ejs index f77735c..1479834 100644 --- a/views/homePage.ejs +++ b/views/homePage.ejs @@ -3,7 +3,7 @@
-
Creating Unix pipelines has never been easier!
Blockly Unix is the perfect starting point for those looking to learn Unix. It combines the power of Unix tools with an intuitive, block-based interface, making it easier than ever to grasp the fundamentals of Unix while building real-world data processing pipelines.
+Ublocks is the perfect starting point for those looking to learn Unix. It combines the power of Unix tools with an intuitive, block-based interface, making it easier than ever to grasp the fundamentals of Unix while building real-world data processing pipelines.
Blockly for Unix provides cross-platform support, allowing users to create and execute commands across different operating systems without limitations.
+Ublocks provides cross-platform support, allowing users to create and execute commands across different operating systems without limitations.
Blockly for Unix offers a visual interface, enabling users to build and execute commands easily without the need for complex scripting.
+Ublocks offers a visual interface, enabling users to build and execute commands easily without the need for complex scripting.
@@ -219,7 +219,7 @@- Whether you are a student, educator, or professional interested in learning Unix, Blockly Unix offers an intuitive, block-based approach to mastering Unix fundamentals. + Whether you are a student, educator, or professional interested in learning Unix, Ublocks offers an intuitive, block-based approach to mastering Unix fundamentals.