scripts

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const MAXIMUM_NESTING_LEVEL = 2

To prevent infinite recursion, we limit the nesting level of script dependencies

View Source
const SCRIPT_IDENTIFIER_REGEXP = `^(\S+):\s*(.*)$`
View Source
const SHEBANG_REGEXP = "#!\\s?(\\S+)\\s?(.*)"

Variables

View Source
var TEMP_SCRIPT_FILE = ""

The file we use to store the script we want to execute

Functions

func MakeHelp added in v0.1.2

func MakeHelp(file io.Reader) string

func RunScript

func RunScript(script *Script, arguments []string) (status int, err error)

Creates an exec.Cmd that executes a script in a given shell Arguments are positional arguments ($1, $2...) which can be used in the script as replacement

Types

type Script

type Script struct {
	Name         string
	Lines        []string
	Interpreter  string
	Options      []string
	Dependencies []Script
}

A script is a slice of lines representing each a LOC

func ReadScript

func ReadScript(scriptName string, shell string, fileContent []byte, currentNestingLevel uint) (script *Script, err error)

Parses the provided file, retuning the Script whose name is the provided one

Jump to

Keyboard shortcuts

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