fileutil

package
v0.0.0-...-389821e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2018 License: BSD-3-Clause, BSD-3-Clause Imports: 3 Imported by: 0

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

func HasShebang(bs []byte) bool

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 ScriptConfidence = iota
	ConfIfShebang
	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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL