ukgen

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: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParamsMapAdd

func ParamsMapAdd[K, V any](paramsMap ParamsMap)

Types

type Config

type Config struct {
	Log   *slog.Logger
	Spec  []ukspec.Option
	Names ConfigNames
	Types ConfigTypes
}

type ConfigNames

type ConfigNames struct {
	Package            string
	EncoderConstructor string
	EncoderDefault     string
	EncoderType        string
	ParameterTypes     map[reflect.Type]string
}

type ConfigTypes

type ConfigTypes struct {
	ArgumentInfo reflect.Type
	FlagInfo     reflect.Type
}

type Encoder

type Encoder[T any] func(info any) (description T, err error)

func (Encoder[T]) Encode

func (e Encoder[T]) Encode(in Input) (ukhelp.Output[T], error)

func (Encoder[T]) EncodeArguments

func (e Encoder[T]) EncodeArguments(in Input) ([]ukhelp.OutputArgument[T], error)

func (Encoder[T]) EncodeCommand

func (e Encoder[T]) EncodeCommand(in Input) (ukhelp.OutputCommand[T], error)

func (Encoder[T]) EncodeFlags

func (e Encoder[T]) EncodeFlags(in Input) ([]ukhelp.OutputFlag[T], error)

func (Encoder[T]) EncodeSubcommands

func (e Encoder[T]) EncodeSubcommands(in Input) ([]ukhelp.OutputSubcommand[T], error)

type GenerateOutput

type GenerateOutput struct{ io.Writer }

func (GenerateOutput) MarshalText

func (o GenerateOutput) MarshalText() ([]byte, error)

func (*GenerateOutput) UnmarshalText

func (o *GenerateOutput) UnmarshalText(text []byte) (err error)

type GenerateParams

type GenerateParams struct {
	Out GenerateOutput `ukflag:"o out"`
}

func (*GenerateParams) UkaseInit

func (gp *GenerateParams) UkaseInit()

type Generator

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

func NewGenerator

func NewGenerator(opts ...Option) *Generator

func (Generator) Bind

func (g Generator) Bind(target ...string) ukcli.Directive

func (*Generator) Generate

func (g *Generator) Generate(out io.Writer) error

func (Generator) Handle

func (g Generator) Handle(_ context.Context, params GenerateParams) error

func (*Generator) Middleware

func (g *Generator) Middleware(s ukcli.State) ukcli.State

type Input

type Input interface {
	ukmeta.Input

	MetaInfo(index []int) (any, error)
}

type Option

type Option interface{ UkaseApplyGen(*Config) }

type ParamsMap

type ParamsMap map[reflect.Type]reflect.Type

func (ParamsMap) NewInput

func (pm ParamsMap) NewInput(in ukmeta.Input) Input

Jump to

Keyboard shortcuts

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