Documentation
¶
Overview ¶
Package parser provides command file parsing functionality.
Package parser provides command file parsing functionality.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrEmptyFile = errors.New("file is empty") ErrMalformedFrontmatter = errors.New("malformed frontmatter") )
Sentinel errors for command parsing.
Functions ¶
This section is empty.
Types ¶
type Commandable ¶
Commandable is implemented by command types that can have their Name and Instructions set.
type ParseError ¶
ParseError represents an error that occurred while parsing a command file.
func (*ParseError) Error ¶
func (e *ParseError) Error() string
func (*ParseError) Unwrap ¶
func (e *ParseError) Unwrap() error
type Parser ¶
type Parser[T Commandable] struct{}
Parser handles command file parsing operations.
func (*Parser[T]) Parse ¶
Parse reads and parses a command from the given reader. The path parameter is used for error context and name inference.
func (*Parser[T]) ParseBytes ¶
ParseBytes parses command content from bytes. The path parameter is used for error context and name inference.
func (*Parser[T]) ParseFile ¶
ParseFile reads and parses a command file from the given path. Returns the parsed command or an error if parsing fails.
func (*Parser[T]) ParseHeader ¶
ParseHeader parses only the frontmatter metadata, stopping at the closing ---. This is more efficient for listing commands without reading full content.