From 9f023f5cd9188c343d3b015f3439b34dea715b6a Mon Sep 17 00:00:00 2001 From: ewy Date: Sat, 21 Nov 2026 15:31:02 +0100 Subject: warning message for scripts without shebang --- runner/shell/shell.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'runner/shell') diff --git a/runner/shell/shell.go b/runner/shell/shell.go index f696a46..6c9a1ed 100644 --- a/runner/shell/shell.go +++ b/runner/shell/shell.go @@ -23,6 +23,7 @@ var NoShellError = errors.New("could not find any shell interpreters") var ExtShellMap = map[string]string{ ".bash": "bash", + ".zsh": "zsh", ".fish": "fish", ".ps1": "powershell", ".bat": "cmd", @@ -39,6 +40,8 @@ type shell struct { Locations map[string]string } +var AmbiguousScriptError = errors.New("ambiguous script without shebang\nadd first line #!/usr/bin/env bash") + func (s *shell) Wants(f fs.FS, file string, entry fs.DirEntry) (bool, error) { if entry != nil && entry.IsDir() { return false, nil @@ -62,6 +65,9 @@ func (s *shell) Wants(f fs.FS, file string, entry fs.DirEntry) (bool, error) { return true, nil } } + if filepath.Ext(file) == ".sh" { + return true, AmbiguousScriptError + } return false, nil } -- cgit v1.3.1