cli

package
v0.62.2 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithDefaultErrorHandler

func WithDefaultErrorHandler(handler ErrorHandler)

func WithRunFunc added in v0.62.1

func WithRunFunc(f func(ctx context.Context, config cfg.Config, logger log.Logger) (kernelPkg.ModuleRunFunc, error)) kernelPkg.ModuleFactory

Types

type Blueprint added in v0.62.1

type Blueprint struct {
	Cmd   []string
	Args  []string
	Flags []BlueprintFlag
}

func NewBlueprint added in v0.62.1

func NewBlueprint(router *Router, input *Input) *Blueprint

type BlueprintFlag added in v0.62.1

type BlueprintFlag struct {
	Key        string
	CustomKey  string
	Value      string
	AppOptions []application.Option
}

type Cli added in v0.62.1

type Cli struct {
	*Router
	// contains filtered or unexported fields
}

func NewCli added in v0.62.1

func NewCli(options ...Option) *Cli

func (*Cli) Run added in v0.62.1

func (c *Cli) Run()

type Cmd added in v0.62.1

type Cmd struct {
	Name          string
	Flags         []Flag
	AppOptions    []application.Option
	ModuleFactory kernelPkg.ModuleFactory
}

type ErrorHandler

type ErrorHandler func(msg string, args ...any)

type Flag added in v0.62.1

type Flag struct {
	Short       string
	Long        string
	CfgKey      string
	Default     string
	Description string
	AppOptions  []application.Option
}

type Group added in v0.62.1

type Group struct {
	Name       string
	Flags      []Flag
	AppOptions []application.Option
	// contains filtered or unexported fields
}

type Input added in v0.62.1

type Input struct {
	Arguments []string
	Flags     map[string]string
}

Input contains the parsed command line arguments and flags.

func NewInput added in v0.62.1

func NewInput() *Input

NewInput parses the current process command line arguments.

func NewInputWithArgs added in v0.62.1

func NewInputWithArgs(args []string) *Input

type LogHandler added in v0.62.1

type LogHandler struct {
}

func (LogHandler) ChannelLevel added in v0.62.1

func (l LogHandler) ChannelLevel(name string) (level *int, err error)

func (LogHandler) Level added in v0.62.1

func (l LogHandler) Level() int

func (LogHandler) Log added in v0.62.1

func (l LogHandler) Log(ctx context.Context, timestamp time.Time, level int, msg string, args []any, logErr error, data log.Data) error

type Option added in v0.62.1

type Option func(cli *Cli)

func WithAppOptions added in v0.62.1

func WithAppOptions(option ...application.Option) Option

func WithFlag added in v0.62.1

func WithFlag(flag Flag) Option

func WithVersion added in v0.62.1

func WithVersion(version string) Option

type Router added in v0.62.1

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

func NewRouter added in v0.62.1

func NewRouter(parent *Router) *Router

func (*Router) Cmd added in v0.62.1

func (r *Router) Cmd(cmd Cmd) *Router

func (*Router) DefaultCmd added in v0.62.1

func (r *Router) DefaultCmd(cmd Cmd) *Router

func (*Router) Group added in v0.62.1

func (r *Router) Group(group Group) *Router

Jump to

Keyboard shortcuts

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