From b70dfa660ff7ba58b8f66fb5d067b0992efe6438 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Sun, 18 Jan 2026 00:06:00 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/ui/app.go | 24 +++++++++++++++++++++--- internal/ui/styles.go | 16 +++++++++++----- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/internal/ui/app.go b/internal/ui/app.go index c8088f3..1746ad4 100644 --- a/internal/ui/app.go +++ b/internal/ui/app.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "os/exec" "strings" "time" @@ -43,8 +44,11 @@ const ( // 消息类型 type ( - progressMsg types.Progress - installCompleteMsg struct{ err error } + progressMsg types.Progress + installCompleteMsg struct { + err error + info string + } uninstallCompleteMsg struct{ err error } mountCompleteMsg struct{ err error } countdownTickMsg struct{ remaining int } @@ -84,6 +88,7 @@ type App struct { installErr error installRunning bool installDone bool + installInfo string // 安装完成后的面板信息 // 卸载 uninstallCountdown int @@ -341,6 +346,7 @@ func (a *App) updateInstall(msg tea.Msg) (tea.Model, tea.Cmd) { a.installRunning = false a.installDone = true a.installErr = msg.err + a.installInfo = msg.info return a, nil case spinner.TickMsg: @@ -393,7 +399,15 @@ func (a *App) startInstall() tea.Cmd { close(progressCh) time.Sleep(100 * time.Millisecond) - return installCompleteMsg{err: err} + // 安装成功后获取面板信息 + var info string + if err == nil { + cmd := exec.CommandContext(ctx, "/usr/local/sbin/acepanel", "info") + output, _ := cmd.Output() + info = string(output) + } + + return installCompleteMsg{err: err, info: info} } } @@ -411,6 +425,10 @@ func (a *App) viewInstall() string { sb.WriteString(ErrorBoxStyle.Render(a.installErr.Error())) } else { sb.WriteString(RenderSuccess(i18n.T.Get("Installation successful"))) + if a.installInfo != "" { + sb.WriteString("\n\n") + sb.WriteString(InfoBoxStyle.Render(strings.TrimSpace(a.installInfo))) + } } sb.WriteString("\n\n") sb.WriteString(RenderHelp("Enter", i18n.T.Get("Back"))) diff --git a/internal/ui/styles.go b/internal/ui/styles.go index ac6989c..9260773 100644 --- a/internal/ui/styles.go +++ b/internal/ui/styles.go @@ -15,11 +15,12 @@ var ( // Logo ASCII艺术 const Logo = ` - _ ____ _ - / \ ___ ___ | _ \ __ _ _ __ ___| | - / _ \ / __/ _ \ | |_) / _` + "`" + ` | '_ \ / _ \ | - / ___ \ (_| __/ | __/ (_| | | | | __/ | -/_/ \_\___\___| |_| \__,_|_| |_|\___|_| + █████╗ ██████╗███████╗██████╗ █████╗ ███╗ ██╗███████╗██╗ + ██╔══██╗██╔════╝██╔════╝██╔══██╗██╔══██╗████╗ ██║██╔════╝██║ + ███████║██║ █████╗ ██████╔╝███████║██╔██╗ ██║█████╗ ██║ + ██╔══██║██║ ██╔══╝ ██╔═══╝ ██╔══██║██║╚██╗██║██╔══╝ ██║ + ██║ ██║╚██████╗███████╗██║ ██║ ██║██║ ╚████║███████╗███████╗ + ╚═╝ ╚═╝ ╚═════╝╚══════╝╚═╝ ╚═╝ ╚═╝╚═╝ ╚═══╝╚══════╝╚══════╝ ` // 样式定义 @@ -64,6 +65,11 @@ var ( BorderForeground(ColorError). Padding(1, 2) + InfoBoxStyle = lipgloss.NewStyle(). + Border(lipgloss.RoundedBorder()). + BorderForeground(ColorPrimary). + Padding(1, 2) + LogStyle = lipgloss.NewStyle(). Foreground(ColorMuted). PaddingLeft(4)