cli

package
v0.0.0-...-b68e1bd Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: Unlicense Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetConfigIn

func SetConfigIn(in string)

SetConfigIn 设置配置文件路径

Types

type App

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

func NewApp

func NewApp(prefix, appname string, opts ...Option) *App

func (*App) Run

func (a *App) Run()

type Command

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

func (*Command) AddCommand

func (c *Command) AddCommand(cmd *Command)

func (*Command) AddCommands

func (c *Command) AddCommands(cmds ...*Command)

type CompleteableOptions

type CompleteableOptions interface {
	Complete() error
}

CompleteableOptions 抽象可以完成/编译的options

type ConfigurableOptions

type ConfigurableOptions interface {
	ApplyFlags() []error
}

ConfigurableOptions 抽象用于从配置文件读取参数的配置选项。

type FlagInterface

type FlagInterface interface {
	// Flags 添加命令行
	Flags() (fs FlagSet)
	// Validate 验证
	Validate() []error
}

FlagInterface 命令行读取配置

type FlagSet

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

func (*FlagSet) Flags

func (fs *FlagSet) Flags(name string) *pflag.FlagSet

type Option

type Option func(*App)

func WithCommand

func WithCommand(use, short, long string) Option

WithCommand 设置命令行参数

func WithConfig

func WithConfig(noConfig bool) Option

func WithDescription

func WithDescription(desc string) Option

func WithFlags

func WithFlags(fi FlagInterface) Option

func WithRunFunc

func WithRunFunc(run RunFunc) Option

func WithVersion

func WithVersion(noVersion bool) Option

type PrintableOptions

type PrintableOptions interface {
	String() string
}

PrintableOptions 抽象可以打印的options

type RunCommandFunc

type RunCommandFunc func(args []string) error

type RunFunc

type RunFunc func(app string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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