-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcommand_interface.go
More file actions
70 lines (63 loc) · 2.62 KB
/
Copy pathcommand_interface.go
File metadata and controls
70 lines (63 loc) · 2.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// Copyright (c) 2025 lamxy and Contributors
// SPDX-License-Identifier: MIT
//
// Author: lamxy <pytho5170@hotmail.com>
// GitHub: https://github.com/lamxy
package fiberhouse
type FrameCmdStarter interface {
IStarter
// GetContext 获取应用上下文
GetContext() ICommandContext
// RegisterApplicationGlobals 注册应用预定义的全局对象实例到全局管理器容器中
RegisterApplicationGlobals()
// RegisterLoggerWithOriginToContainer 将预定义带日志源日志器注册到全局管理器容器中
RegisterLoggerWithOriginToContainer()
// RegisterApplication 注册应用注册器对象到启动器的Application属性
RegisterApplication(application ApplicationCmdRegister)
// GetFrameCmdApp 获取框架命令行应用启动器实例
GetFrameCmdApp() FrameCmdStarter
}
type CoreCmdStarter interface {
// GetAppContext 获取应用上下文
GetAppContext() ICommandContext
// InitCoreApp 初始化核心命令行应用
InitCoreApp()
// RegisterCoreApp 注册底层核心命令行应用实例
RegisterCoreApp(interface{})
// RegisterGlobalErrHandler 注册全局错误处理器
RegisterGlobalErrHandler(fca FrameCmdStarter)
// RegisterCommands 收集命令列表并注册到核心应用
RegisterCommands(fca FrameCmdStarter)
// RegisterCoreGlobalOptional 注册应用核心的全局初始化,如果有必要
RegisterCoreGlobalOptional(fca FrameCmdStarter)
// AppCoreRun 运行核心命令行应用
AppCoreRun() error
// GetCoreCmdApp 获取核心命令行应用实例
GetCoreCmdApp() CoreCmdStarter
}
// CommandStarter 命令行脚本启动器接口,定义命令行程序启动流程
type CommandStarter interface {
FrameCmdStarter
CoreCmdStarter
}
// ApplicationCmdRegister 命令行应用注册器
// 由用户自定义的,在CMD应用启动器启动时,实现必要的应用逻辑,
// 并注册绑定到CommandStarter的application属性,由启动器调用完成应用初始化
type ApplicationCmdRegister interface {
IRegister
IApplication
// GetContext 返回全局上下文
GetContext() ICommandContext
// RegisterGlobalErrHandler 注册全局错误处理器到核心应用
RegisterGlobalErrHandler(core interface{})
// RegisterCommands 收集命令列表并注册到核心应用
RegisterCommands(core interface{})
// RegisterCoreGlobalOptional 注册应用核心的全局可选项
RegisterCoreGlobalOptional(core interface{})
// RegisterApplicationGlobals 注册应用预定义的全局对象实例到全局管理器容器中
RegisterApplicationGlobals()
}
// CommandGetter 命令获取器接口,定义了获取单个命令的方法
type CommandGetter interface {
GetCommand() interface{}
}