source

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrQuitEarly = errors.New("quit early")

Functions

This section is empty.

Types

type EnvOption

type EnvOption func(*envSource) error

func EnvSplitter

func EnvSplitter(splitter string) EnvOption

type FileCodec

type FileCodec interface {
	TagName() string
	ExtName() string
	Encode(path string, v any) error
	Decode(path string, v any) error
}

type FileOption

type FileOption func(*fileSource) error

func FileFormat

func FileFormat(codec FileCodec) FileOption

func FilePathFlag

func FilePathFlag(name string) FileOption

type FlagOption

type FlagOption func(*flagSource) error

func FlagSplitter

func FlagSplitter(splitter string) FlagOption

type FlagSet

type FlagSet interface {
	PrintDefaults()
	Parse([]string) error
	Parsed() bool

	TextVar(p encoding.TextUnmarshaler, name string, value encoding.TextMarshaler, usage string)
	StringVar(v *string, name string, defaultValue string, usage string)
	BoolVar(v *bool, name string, defaultValue bool, usage string)
}

type JSON

type JSON struct{}

func (JSON) Decode

func (JSON) Decode(path string, v any) error

func (JSON) Encode

func (JSON) Encode(path string, v any) error

func (JSON) ExtName

func (JSON) ExtName() string

func (JSON) TagName

func (JSON) TagName() string

type Source

type Source interface {
	Register(fset FlagSet, fields []structtags.Field) error
	Parse(ctx context.Context, args []string) error
	Error() error
}

func Env

func Env(options ...EnvOption) Source

func File

func File(options ...FileOption) Source

func Flag

func Flag(opt ...FlagOption) Source

Jump to

Keyboard shortcuts

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