diff --git a/script/fetch-fixtures b/script/fetch-fixtures index 1eec16ee..59af3f8b 100755 --- a/script/fetch-fixtures +++ b/script/fetch-fixtures @@ -1,6 +1,6 @@ #!/usr/bin/env bash -GRAMMARS_DIR=$(dirname $0)/../test/fixtures/grammars +GRAMMARS_DIR=$(dirname "$0")/../test/fixtures/grammars fetch_grammar() { local grammar=$1 @@ -10,13 +10,13 @@ fetch_grammar() { echo "Updating ${grammar} grammar..." - if [ ! -d $grammar_dir ]; then - git clone $grammar_url $grammar_dir --depth=1 + if [ ! -d "$grammar_dir" ]; then + git clone "$grammar_url" "$grammar_dir" --depth=1 fi ( - cd $grammar_dir - git fetch origin $ref --depth=1 + cd "$grammar_dir" || exit + git fetch origin "$ref" --depth=1 git reset --hard FETCH_HEAD ) } diff --git a/script/generate-fixtures b/script/generate-fixtures index 2c3b178a..5c0f74f5 100755 --- a/script/generate-fixtures +++ b/script/generate-fixtures @@ -15,7 +15,7 @@ fi filter_grammar_name=$1 grammars_dir=${root_dir}/test/fixtures/grammars -grammar_files=$(find $grammars_dir -name grammar.js | grep -v node_modules) +grammar_files=$(find "$grammars_dir" -name grammar.js | grep -v node_modules) while read -r grammar_file; do grammar_dir=$(dirname "$grammar_file") @@ -27,7 +27,7 @@ while read -r grammar_file; do echo "Regenerating ${grammar_name} parser" ( - cd $grammar_dir + cd "$grammar_dir" "$tree_sitter" generate src/grammar.json --no-bindings --abi=latest ) done <<< "$grammar_files"