cli

package
v2.162.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2025 License: MIT Imports: 9 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// FS for cli.
	FS = os.NewFS()

	// Name for cli.
	Name = env.NewName(FS)

	// Version for cli.
	Version = env.NewVersion()
)

Functions

This section is empty.

Types

type Application

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

Application for cli.

func NewApplication

func NewApplication(register RegisterFunc, opts ...ApplicationOption) *Application

NewApplication for cli.

func (*Application) AddClient

func (a *Application) AddClient(name, description string, opts ...Option) *Command

AddClient sub command.

func (*Application) AddServer

func (a *Application) AddServer(name, description string, opts ...Option) *Command

AddServer sub command.

func (*Application) ExitOnError

func (a *Application) ExitOnError(ctx context.Context)

ExitOnError will run the application and exit on error.

func (*Application) Run

func (a *Application) Run(ctx context.Context) error

Run the application.

type ApplicationOption

type ApplicationOption interface {
	// contains filtered or unexported methods
}

ApplicationOption for cli.

func WithApplicationExit

func WithApplicationExit(exiter ExitFunc) ApplicationOption

WithApplicationExit for cli.

type Command

type Command struct {
	*flag.FlagSet
}

Command for cli.

func NewCommand added in v2.66.0

func NewCommand(name string) *Command

NewCommand creates a new command with the given name.

type Commander

type Commander interface {
	// AddServer sub command.
	AddServer(name, description string, opts ...Option) *Command

	// AddClient sub command.
	AddClient(name, description string, opts ...Option) *Command
}

Commander allows adding different sub commands.

type ExitFunc added in v2.105.0

type ExitFunc = func(code int)

ExitFunc for cli.

type Option

type Option = di.Option

Option is an alias of di.Option.

type RegisterFunc

type RegisterFunc = func(commander Commander)

RegisterFunc for cli.

Jump to

Keyboard shortcuts

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