constants

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error string

Error is the single sentinel error type for the yupsh REPL. Every error the program can emit is a constant of this type, so callers test with errors.Is rather than comparing strings.

const (
	// ErrArgsMidPipeline is returned when a non-first segment carries positional
	// arguments (files or literal input); only the first segment may source
	// input into the pipeline.
	ErrArgsMidPipeline Error = "positional arguments are only allowed on the first command"
	// ErrEmptyCommand is returned for a pipeline segment with no command name.
	ErrEmptyCommand Error = "empty command"
	// ErrFlagNeedsValue is returned when a value-taking flag has no value.
	ErrFlagNeedsValue Error = "flag requires a value"
	// ErrInvalidFlagValue is returned when a flag value is malformed.
	ErrInvalidFlagValue Error = "invalid flag value"
	// ErrInvalidNumber is returned when a numeric argument fails to parse.
	ErrInvalidNumber Error = "invalid number"
	// ErrMissingArgument is returned when a required positional is absent.
	ErrMissingArgument Error = "missing required argument"
	// ErrSourceMidPipeline is returned when a source command (echo, seq, ls,
	// find, yes, emit) appears after a pipe, where only filters are valid.
	ErrSourceMidPipeline Error = "source command cannot appear after a pipe"
	// ErrUnknownCommand is returned for a command name not in the registry.
	ErrUnknownCommand Error = "unknown command"
	// ErrUnknownFlag is returned for a flag not declared by the command.
	ErrUnknownFlag Error = "unknown flag"
	// ErrUnterminatedQuote is returned when a line ends inside a quoted span.
	ErrUnterminatedQuote Error = "unterminated quote"
)

Keep these constants sorted alphabetically.

func (Error) Error

func (e Error) Error() string

Error satisfies the error interface.

func (Error) With

func (e Error) With(cause error, args ...any) error

With wraps an optional cause and optional context arguments around the sentinel while keeping errors.Is(result, e) true. It mirrors the framework's gloo.Error.With (and gomatic/template.cli's constants.Error.With) so error construction stays uniform across the ecosystem.

Jump to

Keyboard shortcuts

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