cli

package
v2.65.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 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

func Provide added in v2.64.0

func Provide() (*os.FS, env.Name, env.Version)

Provide is used for fx.

Types

type Application

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

Application for cmd.

func NewApplication

func NewApplication(register RegisterFunc) *Application

NewApplication for cmd.

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 Command

type Command struct {
	*flag.FlagSet
}

Command for cli.

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 Option

type Option = di.Option

Option is an alias of di.Option.

type RegisterFunc

type RegisterFunc = func(commander Commander)

RegisterFunc for cmd.

Jump to

Keyboard shortcuts

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