Documentation
¶
Index ¶
- Variables
- func Run(ctx context.Context, reader io.ReaderAt, size int64, opt ...Option) error
- func RunBytes(ctx context.Context, b []byte, opts ...Option) error
- func RunFile(ctx context.Context, filename string, opts ...Option) error
- func Version() string
- func WithOS(ctx context.Context, o OS) context.Context
- type DirEntry
- type Error
- type ExitHandler
- type FS
- type File
- type FileInfo
- type FileMode
- type Group
- type OS
- type Option
- type Pipe
- type User
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrFSNotFound is returned when a filesystem is not found for a given scheme. ErrFSNotFound = errors.New("filesystem not found") // ErrCrossingFSBoundaries is returned when an operation crosses filesystem boundaries. ErrCrossingFSBoundaries = errors.New("crossing filesystem boundaries") )
Functions ¶
Types ¶
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error represents an error that occurred during script execution.
type FS ¶
type FS interface {
Mkdir(name string, perm FileMode) error
MkdirAll(path string, perm FileMode) error
MkdirTemp(dir, pattern string) (string, error)
OpenFile(name string, flag int, perm FileMode) (File, error)
ReadFile(name string) ([]byte, error)
Remove(name string) error
RemoveAll(path string) error
Rename(oldpath, newpath string) error
Stat(name string) (FileInfo, error)
Symlink(oldname, newname string) error
WriteFile(name string, data []byte, perm FileMode) error
ReadDir(name string) ([]DirEntry, error)
}
FS is an interface for a filesystem.
type OS ¶
type OS interface {
FS
Args() []string
Chdir(dir string) error
Environ() []string
Exit(code int)
Getpid() int
Getuid() int
Getwd() (dir string, err error)
Hostname() (name string, err error)
Setenv(key, value string) error
Getenv(key string) string
Unsetenv(key string) error
LookupEnv(key string) (string, bool)
TempDir() string
UserCacheDir() (string, error)
UserConfigDir() (string, error)
UserHomeDir() (string, error)
Stdin() File
Stdout() File
PathSeparator() rune
PathListSeparator() rune
CurrentUser() (User, error)
LookupUser(name string) (User, error)
LookupUid(uid string) (User, error)
LookupGroup(name string) (Group, error)
LookupGid(gid string) (Group, error)
}
OS provides an interface for interacting with the operating system.
type Option ¶
type Option func(*options)
Option is a function that configures the execution of a script.
func WithBuiltin ¶
WithBuiltin adds a custom builtin function to the script execution environment.
func WithExitHandler ¶ added in v0.1.0
func WithExitHandler(handler ExitHandler) Option
WithExitHandler sets the handler for os.exit calls in the script.
func WithFilesystem ¶
WithFilesystem registers a filesystem for a specific URI scheme.
func WithModule ¶ added in v0.1.0
WithModule adds a custom module to the script execution environment.
func WithStdout ¶ added in v0.1.0
WithStdout sets the standard output file for the script.
Click to show internal directories.
Click to hide internal directories.