SuperAPI AI 工具集

gentleman-installer

通用与其它

查看项目

更新于 10-15 21:50

技能介绍

用途:这是一套面向 Gentleman.Dots TUI 安装器的安装步骤开发模式,触发场景包括编辑 installer.go、新增安装步骤、修改安装流程、调整工具安装、处理备份/恢复、实现非交互模式以及新增操作系统/平台支持。

主要能力与结构:所有步骤遵循 model.go 中的 InstallStep 结构,包含 ID、Name、Description、Status(Pending、Running、Done、Failed、Skipped)、Progress(0.0-1.0)、Error、Interactive 字段。步骤必须在 model.go 的 SetupInstallSteps() 中注册,可按用户选择 m.Choices 做条件添加;执行逻辑统一放在 installer.go 的 executeStep 中,通过 switch 分发到 step{Name}() 函数。

使用方式:新增工具安装时,先在 SetupInstallSteps() 加步骤,再在 executeStep() 加 case,接着创建对应 step 函数,并处理各平台差异(Mac、Linux、Arch、Debian、Termux);用 SendLog() 输出进度,失败时用 wrapStepError() 返回。需要 sudo/密码的步骤设置 Interactive: true 并使用 runInteractiveStep,可配合 system.RunSudo() 或 system.RunSudoWithLogs() 与 tea.ExecProcess。条件步骤检查 m.Choices 和 m.SystemInfo,不满足时可用 StatusSkipped。

常用命令:cd installer && go build ./cmd/gentleman-installer;./gentleman-installer --help;./gentleman-installer --non-interactive --shell=fish;GENTLEMAN_VERBOSE=1 ./gentleman-installer --non-interactive。

限制:资料未提供备份/恢复的具体实现细节、各平台支持的完整范围、版本要求或测试方式,如需这些信息暂未提供。