config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("not found")
)

Functions

func WriteDefault

func WriteDefault(force bool) ([]string, error)

WriteDefault writes the default config.toml and its companion schema.json to the primary XDG config dir, returning the paths written. Unless force is set, it refuses (writing nothing) and returns a *FileExistsError if either target already exists.

Types

type Action

type Action struct {
	Label   string   `toml:"label"`
	Command []string `toml:"command"`
}

Action is one entry in the enter-key menu: Label is the text shown next to its digit, Command is the arg vector run (after {{ }} interpolation) in the cursored repo's directory.

type Config

type Config struct {
	Actions []Action `toml:"actions"`
}

func Default

func Default() Config

func Find

func Find() (string, Config, error)

func FromBytes

func FromBytes(data []byte) (Config, error)

func FromReader

func FromReader(r io.Reader) (Config, error)

type FileExistsError

type FileExistsError struct {
	Path string
}

FileExistsError reports that WriteDefault refused to overwrite an existing target file. Path is the offending file.

func (*FileExistsError) Error

func (e *FileExistsError) Error() string

type Issue

type Issue struct {
	Path    string
	Message string
}

Issue is a single human-readable config problem at a dotted path.

func (Issue) String

func (i Issue) String() string

type TOMLError

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

TOMLError adapts a go-toml decode error into a concise one-line message with the position prefixed ("line R, column C: msg"), since DecodeError.Error() omits the position and DecodeError.String()'s multi-line code frame mangles multi-line spans. It unwraps to the underlying *toml.DecodeError.

func (*TOMLError) Error

func (e *TOMLError) Error() string

func (*TOMLError) Unwrap

func (e *TOMLError) Unwrap() error

type ValidationError

type ValidationError struct {
	Issues []Issue
}

ValidationError reports config values that don't satisfy the schema, as a sorted list of plain-language issues (one per line).

func (*ValidationError) Error

func (e *ValidationError) Error() string

Jump to

Keyboard shortcuts

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