cli

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2025 License: MIT Imports: 13 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

Module for fx.

Functions

This section is empty.

Types

type Application

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

Application for cmd.

func NewApplication

func NewApplication(register RegisterFunc, opts ...ApplicationOption) *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, args ...string)

ExitOnError will run the application and exit on error.

func (*Application) Run

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

Run the application.

type ApplicationOption

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

ApplicationOption for cmd.

func WithApplicationExit

func WithApplicationExit(exit os.ExitFunc) ApplicationOption

WithApplicationExit for cmd.

func WithApplicationName

func WithApplicationName(name env.Name) ApplicationOption

WithApplicationName for cmd.

func WithApplicationVersion

func WithApplicationVersion(version env.Version) ApplicationOption

WithApplicationVersion for cmd.

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 InputConfig

type InputConfig struct {
	*config.Config
}

InputConfig for cmd.

func NewInputConfig

func NewInputConfig(name env.Name, set *flag.FlagSet, enc *encoding.Map, fs *os.FS) *InputConfig

NewInputConfig for cmd.

type Option

type Option = fx.Option

Option is an alias of fx.Option.

type OutputConfig

type OutputConfig struct {
	*config.Config
}

OutputConfig for cmd.

func NewOutputConfig

func NewOutputConfig(name env.Name, set *flag.FlagSet, enc *encoding.Map, fs *os.FS) *OutputConfig

NewOutputConfig for cmd.

type RegisterFunc

type RegisterFunc = func(commander Commander)

RegisterFunc for cmd.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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