ukcli

package
v0.0.0-...-c75472b Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// TODO: Document
	Log *slog.Logger

	// TODO: Document
	Exec []ukexec.Option

	// TODO: Document
	Decode []ukdec.Option

	// TODO: Document
	Init []ukinit.Option

	// TODO: Document
	Spec []ukspec.Option

	// TODO: Document
	Middleware []func(State) State
}

type Directive

type Directive interface{ UkaseRegister(State) error }

func NewDirective

func NewDirective(directive func(State) error) Directive

type Exec

type Exec[Params any] func(context.Context, Input) error

func (Exec[Params]) Bind

func (e Exec[Params]) Bind(target ...string) Directive

type Handler

type Handler[Params any] func(context.Context, Params) error

func NewHandler

func NewHandler[Params any](handler func(context.Context, Params) error) Handler[Params]

func (Handler[Params]) Bind

func (h Handler[Params]) Bind(target ...string) Directive

type Info

type Info struct{ Value any }

func NewInfo

func NewInfo(info any) Info

func (Info) Bind

func (i Info) Bind(target ...string) Directive

type Input

type Input interface {
	Core() ukcore.Input
	Decode(any) error
	Initialize(any) error
	Lookup(target ...string) (ukexec.Meta, error)
}

type Option

type Option interface{ UkaseApplyCLI(*Config) }

type Rule

type Rule[Params any] func(*Params)

func NewRule

func NewRule[Params any](rule func(*Params)) Rule[Params]

func (Rule[Params]) UkaseRegister

func (r Rule[Params]) UkaseRegister(state State) error

type Runtime

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

func NewRuntime

func NewRuntime(opts ...Option) *Runtime

func (*Runtime) Add

func (r *Runtime) Add(directives ...Directive)

func (*Runtime) Execute

func (r *Runtime) Execute(ctx context.Context, values []string) error

type State

type State interface {

	// Registration time utilities
	RegisterExec(exec ukcore.Exec, spec ukspec.Parameters, target ...string) error
	RegisterInfo(info any, target ...string) error
	RegisterRule(rule ukinit.Rule)
	// contains filtered or unexported methods
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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