Skip to content

Commit

Permalink
fix: drop support for DEBUG in grep
Browse files Browse the repository at this point in the history
It actually doesn't work as expected. Also the debug output is not very useful.
  • Loading branch information
jamacku committed Oct 4, 2023
1 parent c9cc531 commit 98b3935
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -132,22 +132,22 @@ has_shebang () {
local file="$1"

# shell shebangs detection
if head -n1 "${file}" | grep ${RUNNER_DEBUG:+"--quiet"} -E '^\s*((#|!)|(#\s*!)|(!\s*#))\s*(/usr(/local)?)?/bin/(env\s+)?(sh|ash|bash|dash|ksh|bats)\b'; then
if head -n1 "${file}" | grep --quiet -E '^\s*((#|!)|(#\s*!)|(!\s*#))\s*(/usr(/local)?)?/bin/(env\s+)?(sh|ash|bash|dash|ksh|bats)\b'; then
return 0
fi

# ShellCheck shell directive detection
if grep ${RUNNER_DEBUG:+"--quiet"} -E '^\s*#\s*shellcheck\s+shell=(sh|ash|bash|dash|ksh|bats)\s*' "${file}"; then
if grep --quiet -E '^\s*#\s*shellcheck\s+shell=(sh|ash|bash|dash|ksh|bats)\s*' "${file}"; then
return 0
fi

# Emacs mode detection
if grep ${RUNNER_DEBUG:+"--quiet"} -E '^\s*#\s+-\*-\s+(sh|ash|bash|dash|ksh|bats)\s+-\*-\s*' "${file}"; then
if grep --quiet -E '^\s*#\s+-\*-\s+(sh|ash|bash|dash|ksh|bats)\s+-\*-\s*' "${file}"; then
return 0
fi

# Vi and Vim modeline filetype detection
if grep ${RUNNER_DEBUG:+"--quiet"} -E '^\s*#\s+vim?:\s+(set\s+)?(ft|filetype)=(sh|ash|bash|dash|ksh|bats)\s*' "${file}"; then
if grep --quiet -E '^\s*#\s+vim?:\s+(set\s+)?(ft|filetype)=(sh|ash|bash|dash|ksh|bats)\s*' "${file}"; then
return 0
fi

Expand Down

0 comments on commit 98b3935

Please sign in to comment.