bin

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppMethodInit = "Init"
	AppMethodRun  = "Run"
)

Variables

This section is empty.

Functions

func Adapter

func Adapter(router *Router)

加载路由器为适配器

func Init

func Init(param []string)

* 初始化

func Register

func Register(name string, cmd interface{})

*

项目注册(单个)

func RegisterApps

func RegisterApps(data map[string]interface{})

*

注册多个项目

Types

type ActionInterface

type ActionInterface interface {
}

项目引用

type App

type App struct {
	Data    map[string]string
	Options []string
	Router  *Router

	Command string // 当前的命令
	// contains filtered or unexported fields
}

func Run

func Run() App

系统运行

func (App) Cwd

func (app App) Cwd() string

*

获取当的工作目录

func (App) HasOptions

func (app App) HasOptions(opt string) bool

* 检测属性是否存在

type Command

type Command struct {
	App App
}

func (*Command) Init

func (command *Command) Init()

引用初始化接口

func (*Command) Run

func (command *Command) Run()

运行应用

type Router

type Router struct {
	// 别名映射组
	Alias        map[string]string
	UnfindAction func(action string) // 路由失败
	EmptyAction  func()              // 路由失败
}

func (*Router) GetAction

func (router *Router) GetAction(action string) string

获取 action参数

Jump to

Keyboard shortcuts

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