Documentation
¶
Overview ¶
Package scripting provides functionality for discovering and loading Lua scripts used for customization and extension of divekit operations.
Index ¶
- func DiscoverAvailableLanguages() []string
- func ScriptDir() (string, error)
- type Error
- func NewHookExecutionError(err error) *Error
- func NewLoadScriptDirectoryError() *Error
- func NewLoadScriptError(err error) *Error
- func NewRegistrationError(err error) *Error
- func NewSandboxViolationError(details string, err error) *Error
- func NewScriptNotFoundError(path string) *Error
- func NewTimeoutError(limit time.Duration, err error) *Error
- type ErrorType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DiscoverAvailableLanguages ¶
func DiscoverAvailableLanguages() []string
DiscoverAvailableLanguages scans the user-level scripts directory (e.g., ~/.divekit/scripts) for language pack directories and returns their names. The hooks, lua and run directories are not packs. If no packs can be discovered, it falls back to a sensible default (currently: ["java"]).
Types ¶
type Error ¶
type Error struct {
apperror.Carrier
ErrorType ErrorType
Message string
Err error
// Limit is the time limit a timeout ran into. It is zero for other errors.
Limit time.Duration
}
Error represents a scripting error with type and optional wrapped error
func NewHookExecutionError ¶
NewHookExecutionError creates an error for hook execution failures.
func NewLoadScriptDirectoryError ¶
func NewLoadScriptDirectoryError() *Error
NewLoadScriptDirectoryError reports a language-pack path that is a file.
func NewLoadScriptError ¶
NewLoadScriptError creates an error for script loading failures.
func NewRegistrationError ¶
NewRegistrationError creates an error for registration failures.
func NewSandboxViolationError ¶
NewSandboxViolationError creates an error for sandbox violations.
func NewScriptNotFoundError ¶
NewScriptNotFoundError creates an error for missing script.
func NewTimeoutError ¶
NewTimeoutError creates an error for a script that ran past its limit. It is not a sandbox violation: the script did nothing it was not allowed to.
type ErrorType ¶
type ErrorType int
ErrorType defines domain-based error categories for the scripting package.
const ( // ErrScript indicates script loading or execution errors. ErrScript ErrorType = iota // ErrSecurity indicates sandbox or security violations. ErrSecurity // ErrNotFound indicates missing scripts. ErrNotFound // ErrTimeout indicates a script or callback that ran past its time limit. ErrTimeout )
Directories
¶
| Path | Synopsis |
|---|---|
|
Package contracts defines interfaces for scripting and transformation operations.
|
Package contracts defines interfaces for scripting and transformation operations. |
|
Package lua provides Lua scripting engine integration
|
Package lua provides Lua scripting engine integration |