Documentation
¶
Index ¶
- Constants
- type ExtManager
- func (m *ExtManager) Add(ext *KiteExt) error
- func (m *ExtManager) CleanInvalid() error
- func (m *ExtManager) Delete(name string) error
- func (m *ExtManager) Dumpfile() error
- func (m *ExtManager) Each(fn func(ext *KiteExt))
- func (m *ExtManager) Exists(name string) bool
- func (m *ExtManager) Ext(name string) (ext *KiteExt, ok bool)
- func (m *ExtManager) Exts() []*KiteExt
- func (m *ExtManager) Init() error
- func (m *ExtManager) QuickAdd(name, desc string, path ...string) error
- func (m *ExtManager) Run(name string, ctx *RunCtx) error
- func (m *ExtManager) Update(ext *KiteExt) error
- type KiteExt
- type MetaSchema
- type PathMap
- type PluginRunner
- type RunCtx
- type VarMap
Constants ¶
View Source
const BinPrefix = "kite-"
BinPrefix kite ext 命令文件名称前缀 eg: kite-abc -> ext: abc
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExtManager ¶
type ExtManager struct {
Disable bool `json:"disable"`
// Metafile kite ext 注册记录文件 default: $config/module/ext.json
Metafile string `json:"metafile"`
// SearchPaths 除了 env PATH 外,额外搜索ext文件的目录
SearchPaths []string `json:"search_paths"`
// PathResolver handler. 用于查找 Metafile 文件
PathResolver func(path string) string
// contains filtered or unexported fields
}
ExtManager kite cli 扩展管理器实现 TODO 重构:将外部工具独立出去 external, 这里只管理 kite extension
func NewExtManager ¶
func NewExtManager() *ExtManager
func (*ExtManager) CleanInvalid ¶
func (m *ExtManager) CleanInvalid() error
CleanInvalid 删除无效的(不存在的)扩展
func (*ExtManager) Each ¶
func (m *ExtManager) Each(fn func(ext *KiteExt))
Each every ext information
func (*ExtManager) Ext ¶
func (m *ExtManager) Ext(name string) (ext *KiteExt, ok bool)
Ext gets ext by name
type KiteExt ¶
type KiteExt struct {
// 扩展名称
Name string `json:"name"`
Desc string `json:"desc"`
// 别名列表
Aliases []string `json:"aliases,omitempty"`
// OsPaths 不同系统平台下的文件路径
// - key: 系统平台 windows, darwin, linux. value: 扩展文件路径
OsPaths map[string]string `json:"os_paths"`
// Args 默认运行参数
Args []string `json:"args,omitempty"`
// 指定默认运行目录
Workdir string `json:"workdir,omitempty"`
Disable bool `json:"disable,omitempty"`
Author string `json:"author,omitempty"`
Version string `json:"version,omitempty"`
Homepage string `json:"homepage,omitempty"`
// BeforeSave 保存前执行 hook.
// - 返回 true 继续保存,返回 false 停止保存
BeforeSave func(ext *KiteExt) bool `json:"-"`
// contains filtered or unexported fields
}
KiteExt kite ext 基本信息
func (*KiteExt) SetAliases ¶
SetAliases set aliases for the extension.
type MetaSchema ¶
MetaSchema kite ext 注册信息文件内容结构
type PathMap ¶
type PathMap struct {
// path alias map: {alias: path}
maputil.Aliases `json:"path_map"`
// if true, must start with prefix on resolve path.
Strict bool `json:"strict"`
// allowed prefix mark for alias, use on resolve. eg: "$,#,@"
Prefixes string `json:"prefixes"`
// FallbackFn if alias not exists, will call this func to get a path.
FallbackFn func(path string) string
// contains filtered or unexported fields
}
PathMap struct
type PluginRunner ¶
type PluginRunner struct {
// DenyNames deny plugin bin names
DenyNames []string `json:"deny_names"`
// PluginDirs plugin bin search dirs
PluginDirs []string `json:"plugin_dirs"`
ConfigFile []string `json:"config_file"`
}
PluginRunner struct
type RunCtx ¶
type RunCtx struct {
Dry bool
// Dir 设置运行目录
Dir string
// Env 设置环境变量
Env map[string]string
// Args 运行参数
Args []string
}
RunCtx data
Click to show internal directories.
Click to hide internal directories.