Skip to content

Commit

Permalink
awk: add support for -M gawk argument
Browse files Browse the repository at this point in the history
  • Loading branch information
vpayno committed Sep 3, 2023
1 parent b8ea8a0 commit 49d8c21
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
10 changes: 8 additions & 2 deletions .github/citools/awk/awk-test
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,15 @@ for d in ${AWKLIBPATH//:/ }; do
printf "\n"
done

declare lint_default_vars
if [[ -f .lint_default_vars ]]; then
read -r lint_default_vars <.lint_default_vars
fi

# shellcheck disable=SC2028
echo Running: gawk --file ./*_test.awk "&&" printf "\n%s\n" "Tests Passed!" "||" printf "\n%s\n" "Tests Failed!"
if time gawk --file ./*_test.awk; then
echo Running: gawk "${lint_default_vars}" --file ./*_test.awk "&&" printf "\n%s\n" "Tests Passed!" "||" printf "\n%s\n" "Tests Failed!"
# shellcheck disable=SC2086
if time gawk ${lint_default_vars} --file ./*_test.awk; then
printf "\n%s\n" "Tests Passed!"
else
((retval++))
Expand Down
9 changes: 8 additions & 1 deletion awk/update_readmes
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,15 @@ EOF

fi

if git grep -q -- '-M'; then
printf -- "%s" " -M" >.lint_default_vars
git add .lint_default_vars
else
: >.lint_default_vars
fi

if git grep -q -- '-v '; then
git grep -- '-v ' *.bats | head -n 1 | sed -r -e 's/.*(-v [a-z]+[=].+) -f.*/\1/g' >.lint_default_vars
git grep -- '-v ' *.bats | head -n 1 | sed -r -e 's/.*(-v [a-z]+[=].+) ?.*/\1/g' | tr -d '\n' >>.lint_default_vars
git add .lint_default_vars
fi

Expand Down

0 comments on commit 49d8c21

Please sign in to comment.