commandstarter

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package commandstarter 提供基于 cli.v2 的命令行应用启动器实现,负责命令行应用的完整生命周期管理和启动流程编排。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCmdApplication

func NewCmdApplication(ctx frame.ContextCommander, registers ...frame.IRegister) frame.CommandStarter

NewCmdApplication 创建一个命令启动器对象,实现CommandStarter接口

func RunCommandStarter

func RunCommandStarter(cmdStarter frame.CommandStarter, core ...interface{})

RunCommandStarter 运行命令启动器

Types

type CmdApplication

type CmdApplication struct {
	Ctx frame.ContextCommander
	// contains filtered or unexported fields
}

CmdApplication 是命令行应用启动器,实现 frame.CommandStarter 接口。 负责管理命令行应用的生命周期,包括初始化、注册全局选项和动作、运行应用及错误处理。

func (*CmdApplication) AppCoreRun

func (cApp *CmdApplication) AppCoreRun() error

AppCoreRun 运行核心应用

func (*CmdApplication) GetApplication

func (cApp *CmdApplication) GetApplication() frame.IApplication

GetApplication 获取应用接口对象

func (*CmdApplication) GetContext

func (cApp *CmdApplication) GetContext() frame.ContextCommander

GetContext 获取全局上下文

func (*CmdApplication) InitCoreApp

func (cApp *CmdApplication) InitCoreApp(core ...interface{})

InitCoreApp 初始化包装的底层核心应用

func (*CmdApplication) RegisterApplication

func (cApp *CmdApplication) RegisterApplication(application frame.ApplicationCmdRegister)

RegisterApplication 注册应用命令注册器到应用启动器

func (*CmdApplication) RegisterApplicationGlobals

func (cApp *CmdApplication) RegisterApplicationGlobals()

RegisterApplicationGlobals 注册应用全局对象初始化器和初始化部分必要对象

func (*CmdApplication) RegisterCommands

func (cApp *CmdApplication) RegisterCommands()

RegisterCommands 注册命令列表到核心应用

func (*CmdApplication) RegisterCoreGlobalOptional

func (cApp *CmdApplication) RegisterCoreGlobalOptional()

RegisterCoreGlobalOptional 注册应用核心的全局可选项

func (*CmdApplication) RegisterGlobalErrHandler

func (cApp *CmdApplication) RegisterGlobalErrHandler()

RegisterGlobalErrHandler 核心应用全局错误处理器

func (*CmdApplication) RegisterLoggerWithOriginToContainer

func (cApp *CmdApplication) RegisterLoggerWithOriginToContainer()

RegisterLoggerWithOriginToContainer 注册配置文件预定义的不同来源(LogOrigin)的子日志器初始化器到容器

Jump to

Keyboard shortcuts

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