cli

package
v1.1.10 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// Version
	Version = "1.0.0"
)

Functions

func AddCommand

func AddCommand(cmds ...*Command) *application

AddCommand

func App

func App() *application

App

func New

func New(name, version string) *application

New

func Run

func Run()

Run

func SetDebug

func SetDebug(debug bool) *application

SetDebug

func SetName

func SetName(name string) *application

SetName

func SetVersion

func SetVersion(version string) *application

SetVersion

func Use

func Use(h ...HandlerFunc) *application

Use

Types

type Command

type Command struct {
	// 命令名称
	Name string
	// 简短描述
	Short string
	// 详细描述
	Long string
	// 使用范例
	// 子命令:"Usage: %s %s [ARG...]"
	// 单命令:"Usage: %s [ARG...]"
	UsageF string
	// 选项
	Options []*Option
	// 执行
	RunF func()
	RunI RunI
	// 是否单命令
	Singleton bool
	// 是否为默认命令
	Default bool
	// contains filtered or unexported fields
}

Command

func (*Command) AddOption

func (t *Command) AddOption(options ...*Option) *Command

AddOption

func (*Command) Use

func (t *Command) Use(h ...HandlerFunc) *Command

Use

type HandlerFunc

type HandlerFunc func(next func())

HandlerFunc

type NotFoundError

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

NotFoundError 未找到错误

func NewNotFoundError

func NewNotFoundError(err error) *NotFoundError

NewNotFoundError 创建未找到错误

type Option

type Option struct {
	Names []string
	Usage string
}

Option

type RunI

type RunI interface {
	Main()
}

RunI

type UnsupportedError

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

UnsupportedError 不支持错误

func NewUnsupportedError

func NewUnsupportedError(err error) *UnsupportedError

NewUnsupportedError 创建不支持错误

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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