Documentation ¶
Overview ¶
Package fileutil contains code to work with shell files, also known as shell scripts.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HasShebang ¶
HasShebang reports whether bs begins with a valid sh or bash shebang. It supports variations with /usr and env.
Types ¶
type ScriptConfidence ¶
type ScriptConfidence int
ScriptConfidence defines how likely a file is to be a shell script, from complete certainty that it is not one to complete certainty that it is one.
const ( // ConfNotScript describes files which are definitely not shell scripts, // such as non-regular files or files with a non-shell extension. ConfNotScript ScriptConfidence = iota // ConfIfShebang describes files which might be shell scripts, depending // on the shebang line in the file's contents. Since CouldBeScript only // works on os.FileInfo, the answer in this case can't be final. ConfIfShebang // ConfIsScript describes files which are definitely shell scripts, // which are regular files with a valid shell extension. ConfIsScript )
func CouldBeScript ¶
func CouldBeScript(info os.FileInfo) ScriptConfidence
CouldBeScript reports how likely a file is to be a shell script. It discards directories, symlinks, hidden files and files with non-shell extensions.
Click to show internal directories.
Click to hide internal directories.