cmdline

package
v0.0.0-...-e4b44d9 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2024 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CmdLine

type CmdLine struct {
	*Command
	// contains filtered or unexported fields
}

func New

func New(app *application.Application, opts ...Option) (*CmdLine, error)

func (*CmdLine) Run

func (cl *CmdLine) Run(args []string) error

type Command

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

func NewCommand

func NewCommand(name, description string, handler func() error) *Command

func (*Command) Add

func (cmd *Command) Add(cmds ...*Command)

func (*Command) BoolVar

func (cmd *Command) BoolVar(p *bool, name string, usage string, loaders ...Loader[bool])

func (*Command) Run

func (cmd *Command) Run(args []string) error

func (*Command) StringVar

func (cmd *Command) StringVar(p *string, name string, usage string, loaders ...Loader[string])

type ConfigLoader

type ConfigLoader func(app *application.Application, filepath string) error

type Loader

type Loader[T any] func(app *application.Application, flag string) (T, error)

func Env

func Env[T any](fn func(app *application.Application, env string) (T, error), envVars ...string) []Loader[T]

func EnvBool

func EnvBool(envVars ...string) []Loader[bool]

func EnvString

func EnvString(envVars ...string) []Loader[string]

type Option

type Option func(*CmdLine)

func WithConfigLoader

func WithConfigLoader(loader ConfigLoader) Option

func WithHandler

func WithHandler(fn func() error) Option

func WithVersionPrinter

func WithVersionPrinter(printer VersionPrinter) Option

type VersionPrinter

type VersionPrinter func(app *application.Application)

Jump to

Keyboard shortcuts

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