Skip to content

Commit

Permalink
fix: fix regex for emacs style annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
jamacku committed Mar 6, 2024
1 parent bc4d40a commit a10f9db
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ has_shebang () {
fi

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

Expand Down
1 change: 1 addition & 0 deletions test/has_shebang.bats
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ setup () {
' # -*- sh -*-'
' # -*- sh -*- ... ...'
'# systemd-sysext(8) completion -*- mode: shell-script -*-'
'# systemd-sysext(8) completion -*- shell script -*-'
)
local emacs_incorrect=(
' -*- sh -*-'
Expand Down

0 comments on commit a10f9db

Please sign in to comment.