cliapp

package
v0.0.0-...-48d27f4 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LifecycleCmd

func LifecycleCmd(fn LifecycleAction) cli.ActionFunc

LifecycleCmd 是一个函数,用于创建一个 cli.ActionFunc。 该函数会调用生命周期管理操作,并在中断信号时优雅地关闭应用。

func ProtectFlags

func ProtectFlags(flags []cli.Flag) []cli.Flag

Types

type CloneableGeneric

type CloneableGeneric interface {
	cli.Generic
	Clone() any
}

type Lifecycle

type Lifecycle interface {
	Start(ctx context.Context) error
	Stop(ctx context.Context) error
	Stopped() bool
}

Lifecycle 接口定义了应用程序的生命周期管理方法。 Start: 启动应用程序。 Stop: 停止应用程序。 Stopped: 检查应用程序是否已经停止。

type LifecycleAction

type LifecycleAction func(ctx *cli.Context, close context.CancelCauseFunc) (Lifecycle, error)

LifecycleAction 是一个函数类型,用于初始化一个生命周期管理对象。 它接收命令行上下文和取消函数,返回一个实现了 Lifecycle 接口的对象。

Jump to

Keyboard shortcuts

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