plugins

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2026 License: MIT Imports: 5 Imported by: 10

Documentation

Overview

Package plugins describes the uconfig provider interface. it exists to enable uconfig.Classic without circular deps.

Index

Constants

This section is empty.

Variables

View Source
var ErrUsage = errors.New("uconfig: usage request")

ErrUsage is returned when user has request usage message via some plugin, mostly flags.

Functions

func RegisterTag

func RegisterTag(name string)

RegisterTag allows providers to ensure their tag is unique. they must call this function from an init.

Types

type Extension added in v0.14.0

type Extension interface {
	Plugin

	Extend([]Plugin) error
}

Extension is the interface for plugins that need access to the full plugin list. Like all plugins, Extensions are set up in registration order — place them after any plugins they need to inspect (e.g. after file plugins so that paths are resolved).

type Plugin

type Plugin interface {
	Parse() error
}

Plugin is the common interface for all uConfig providers.

type Updater added in v0.14.0

type Updater interface {
	// Updated blocks until the plugin's source has changed or ctx is done.
	// Returns true if the source changed, false otherwise.
	Updated(ctx context.Context) bool
}

Updater is an optional interface for plugins that can detect when their backing source has changed. It is used by Watch to trigger re-parsing. Any plugin type (Walker, Visitor, or Extension) can additionally implement Updater.

type Visitor

type Visitor interface {
	Plugin

	Visit(flat.Fields) error
}

Visitor is the interface for providers that require a flat view of the config, like flags, env vars

type Walker

type Walker interface {
	Plugin

	Walk(any) error
}

Walker is the interface for providers that take the whole config, like file loaders.

Directories

Path Synopsis
Package defaults provides default value support for uconfig.
Package defaults provides default value support for uconfig.
Package env provides environment variables support for uconfig
Package env provides environment variables support for uconfig
Package file provides config file support for uconfig
Package file provides config file support for uconfig
Package flag provides flags support for uconfig
Package flag provides flags support for uconfig
Package secret enable uconfig to integrate with secret plugins.
Package secret enable uconfig to integrate with secret plugins.

Jump to

Keyboard shortcuts

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