advargs

package
v2.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2026 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package advargs provides type-safe parsing and validation for ZapScript advanced arguments using struct tags and the go-playground/validator library.

Index

Constants

This section is empty.

Variables

View Source
var DefaultParser = NewParser()

DefaultParser is a convenience parser for simple use cases.

Functions

func IsActionDetails

func IsActionDetails(action string) bool

IsActionDetails returns true if the action is "details" (case-insensitive).

func IsActionRun

func IsActionRun(action string) bool

IsActionRun returns true if the action is "run" or empty (case-insensitive).

func IsModeShuffle

func IsModeShuffle(mode string) bool

IsModeShuffle returns true if the mode is "shuffle" (case-insensitive).

func Parse

func Parse(raw map[string]string, dest any, ctx *ParseContext) error

Parse is a convenience function using the default parser.

func ShouldRun

func ShouldRun(g advargtypes.GlobalArgs) bool

ShouldRun returns true if the command should execute based on the When condition.

Types

type ParseContext

type ParseContext struct {
	LauncherIDs []string
}

ParseContext provides runtime context for validation.

func NewParseContext

func NewParseContext(launcherIDs []string) *ParseContext

NewParseContext creates a ParseContext from a list of launcher IDs.

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

Parser handles parsing and validation of advanced arguments.

func NewParser

func NewParser() *Parser

NewParser creates a new Parser with registered custom validators.

func (*Parser) Parse

func (p *Parser) Parse(raw map[string]string, dest any, ctx *ParseContext) error

Parse decodes raw advanced args into a typed struct and validates them. Returns an error if decoding or validation fails.

Directories

Path Synopsis
Package types provides type definitions and constants for ZapScript advanced arguments.
Package types provides type definitions and constants for ZapScript advanced arguments.

Jump to

Keyboard shortcuts

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