feat: add interactive config setup on first start, install scripts, and uninstall cleanup

This commit is contained in:
2026-03-24 22:46:45 +08:00
parent 35bf24f0f3
commit 850cc49daf
6 changed files with 257 additions and 13 deletions

View File

@@ -130,6 +130,12 @@ func main() {
}
}
}
if config.ConfirmConfigCleanup() {
configDir := config.GetConfigDir()
os.RemoveAll(configDir)
fmt.Println("配置文件与日志已清除。")
}
},
},
{
@@ -178,6 +184,14 @@ func main() {
Use: "start",
Short: "唤起执行守护后台",
Run: func(cmd *cobra.Command, args []string) {
if !config.ConfigFileExists() {
newCfg, err := config.InteractiveSetup()
if err != nil {
logger.Fail("配置初始化失败: %v", err)
return
}
cfg = newCfg
}
handleServiceControl(svc, "start")
},
},