Documentation
¶
Index ¶
- Constants
- Variables
- type AdvArgs
- func (a AdvArgs) Get(key advargtypes.Key) string
- func (a AdvArgs) GetWhen() (string, bool)
- func (a AdvArgs) IsEmpty() bool
- func (a AdvArgs) MarshalJSON() ([]byte, error)
- func (a AdvArgs) Range(fn func(key advargtypes.Key, value string) bool)
- func (a AdvArgs) Raw() map[string]string
- func (a *AdvArgs) UnmarshalJSON(data []byte) error
- func (a AdvArgs) With(key advargtypes.Key, value string) AdvArgs
- type ArgExprEnv
- type Command
- type CustomLauncherExprEnv
- type ExprEnvActiveMedia
- type ExprEnvDevice
- type ExprEnvLastScanned
- type ExprEnvLaunching
- type ExprEnvScanned
- type PostArgPart
- type PostArgPartType
- type Script
- type ScriptReader
Constants ¶
View Source
const ( SymCmdStart = '*' SymCmdSep = '|' SymEscapeSeq = '^' SymArgStart = ':' SymArgSep = ',' SymArgDoubleQuote = '"' SymArgSingleQuote = '\'' SymAdvArgStart = '?' SymAdvArgSep = '&' SymAdvArgEq = '=' SymJSONStart = '{' SymJSONEnd = '}' SymJSONEscapeSeq = '\\' SymJSONString = '"' SymInputMacroEscapeSeq = '\\' SymInputMacroExtStart = '{' SymInputMacroExtEnd = '}' SymExpressionStart = '[' SymExpressionEnd = ']' SymMediaTitleStart = '@' SymMediaTitleSep = '/' SymTagAnd = '+' SymTagNot = '-' SymTagOr = '~' TokExpStart = "\uE000" TokExprEnd = "\uE001" )
Variables ¶
View Source
var ( ErrUnexpectedEOF = errors.New("unexpected end of file") ErrInvalidCmdName = errors.New("invalid characters in command name") ErrInvalidAdvArgName = errors.New("invalid characters in advanced arg name") ErrEmptyCmdName = errors.New("command name is empty") ErrEmptyZapScript = errors.New("script is empty") ErrUnmatchedQuote = errors.New("unmatched quote") ErrInvalidJSON = errors.New("invalid JSON argument") ErrUnmatchedInputMacroExt = errors.New("unmatched input macro extension") ErrUnmatchedExpression = errors.New("unmatched expression") ErrBadExpressionReturn = errors.New("expression return type not supported") )
Functions ¶
This section is empty.
Types ¶
type AdvArgs ¶ added in v2.8.0
type AdvArgs struct {
// contains filtered or unexported fields
}
AdvArgs is a wrapper around raw advanced arguments that enforces type-safe access. Direct map access is not allowed; use the advargs.Parse() function to get typed structs, or the getter/setter methods for pre-parse operations.
func NewAdvArgs ¶ added in v2.8.0
func (AdvArgs) MarshalJSON ¶ added in v2.8.0
func (AdvArgs) Range ¶ added in v2.8.0
func (a AdvArgs) Range(fn func(key advargtypes.Key, value string) bool)
func (*AdvArgs) UnmarshalJSON ¶ added in v2.8.0
type ArgExprEnv ¶
type ArgExprEnv struct {
ActiveMedia ExprEnvActiveMedia `expr:"active_media" json:"active_media"`
Device ExprEnvDevice `expr:"device" json:"device"`
LastScanned ExprEnvLastScanned `expr:"last_scanned" json:"last_scanned"`
Scanned ExprEnvScanned `expr:"scanned" json:"scanned,omitempty"`
Launching ExprEnvLaunching `expr:"launching" json:"launching,omitempty"`
Platform string `expr:"platform" json:"platform"`
Version string `expr:"version" json:"version"`
ScanMode string `expr:"scan_mode" json:"scan_mode"`
MediaPlaying bool `expr:"media_playing" json:"media_playing"`
}
type CustomLauncherExprEnv ¶
type CustomLauncherExprEnv struct {
Platform string `expr:"platform"`
Version string `expr:"version"`
Device ExprEnvDevice `expr:"device"`
MediaPath string `expr:"media_path"`
}
type ExprEnvActiveMedia ¶
type ExprEnvDevice ¶
type ExprEnvLastScanned ¶
type ExprEnvLaunching ¶ added in v2.8.0
type ExprEnvLaunching struct {
Path string `expr:"path" json:"path"`
SystemID string `expr:"system_id" json:"system_id"`
LauncherID string `expr:"launcher_id" json:"launcher_id"`
}
ExprEnvLaunching represents the media about to launch.
type ExprEnvScanned ¶ added in v2.8.0
type ExprEnvScanned struct {
ID string `expr:"id" json:"id"`
Value string `expr:"value" json:"value"`
Data string `expr:"data" json:"data"`
}
ExprEnvScanned represents the token currently being processed.
type PostArgPart ¶
type PostArgPart struct {
Value string
Type PostArgPartType
}
type PostArgPartType ¶
type PostArgPartType int
const ( ArgPartTypeUnknown PostArgPartType = iota ArgPartTypeString ArgPartTypeExpression )
type ScriptReader ¶
type ScriptReader struct {
// contains filtered or unexported fields
}
func NewParser ¶
func NewParser(value string) *ScriptReader
func (*ScriptReader) EvalExpressions ¶
func (sr *ScriptReader) EvalExpressions(exprEnv any) (string, error)
func (*ScriptReader) ParseExpressions ¶
func (sr *ScriptReader) ParseExpressions() (string, error)
ParseExpressions parses and converts expressions in the input string from [[...]] formatted expression fields to internal expression token delimiters, to be evaluated by the EvalExpressions function. This function ONLY parses expression symbols and escape sequences, no other ZapScript syntax.
func (*ScriptReader) ParseScript ¶
func (sr *ScriptReader) ParseScript() (Script, error)
Click to show internal directories.
Click to hide internal directories.