cli

package
v0.0.0-...-04135fb Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Env

func Env[T any](fn func(app, env string) (T, error), envVars ...string) []func(app, flag string) (T, error)

func EnvBool

func EnvBool(envVars ...string) []func(app, flag string) (bool, error)

func EnvString

func EnvString(envVars ...string) []func(app, flag string) (string, error)

Types

type Cli

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

func New

func New(appName string, opts ...Option) (*Cli, error)

func (*Cli) Run

func (cli *Cli) 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 ...func(app, flag string) (bool, error))

func (*Command) Run

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

func (*Command) StringVar

func (cmd *Command) StringVar(p *string, name string, usage string,
	loaders ...func(app, flag string) (string, error))

type Option

type Option func(*Cli)

func WithHandler

func WithHandler(fn func() error) Option

func WithVersionFunc

func WithVersionFunc(fn func()) Option

func WithconfigFile

func WithconfigFile(fn func(app, file string) error) Option

Jump to

Keyboard shortcuts

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