2026-02-21 20:22:21 +08:00
|
|
|
|
package wizard
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/charmbracelet/lipgloss"
|
|
|
|
|
|
)
|
|
|
|
|
|
|
2026-02-27 22:52:15 +08:00
|
|
|
|
var split_line = splitlineStyle.Render(
|
|
|
|
|
|
"───────────────────────────────────────────────────────────────")
|
|
|
|
|
|
|
2026-02-21 20:22:21 +08:00
|
|
|
|
// View 渲染视图
|
|
|
|
|
|
func (m model) View() string {
|
|
|
|
|
|
if m.done {
|
|
|
|
|
|
return successView()
|
|
|
|
|
|
}
|
|
|
|
|
|
if m.quitting {
|
|
|
|
|
|
return quitView()
|
|
|
|
|
|
}
|
|
|
|
|
|
if m.err != nil {
|
|
|
|
|
|
return errorView(m.err)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-27 22:52:15 +08:00
|
|
|
|
var pageContent string
|
2026-02-21 20:22:21 +08:00
|
|
|
|
switch m.currentPage {
|
|
|
|
|
|
case PageAgreement:
|
2026-02-27 22:52:15 +08:00
|
|
|
|
pageContent = renderLicensePage(m)
|
2026-02-21 20:22:21 +08:00
|
|
|
|
case PageData:
|
2026-02-27 22:52:15 +08:00
|
|
|
|
pageContent = renderDataInfoPage(m)
|
2026-02-21 20:22:21 +08:00
|
|
|
|
case PagePublicNetwork:
|
2026-02-27 22:52:15 +08:00
|
|
|
|
pageContent = renderPublicNetworkPage(m)
|
2026-02-21 20:22:21 +08:00
|
|
|
|
case PageInternalNetwork:
|
2026-02-27 22:52:15 +08:00
|
|
|
|
pageContent = renderInternalNetworkPage(m)
|
2026-02-21 20:22:21 +08:00
|
|
|
|
case PageDNS:
|
2026-02-27 22:52:15 +08:00
|
|
|
|
pageContent = renderDNSPage(m)
|
2026-02-21 20:22:21 +08:00
|
|
|
|
case PageSummary:
|
2026-02-27 22:52:15 +08:00
|
|
|
|
pageContent = renderSummaryPage(m)
|
2026-02-21 20:22:21 +08:00
|
|
|
|
|
2026-02-27 22:52:15 +08:00
|
|
|
|
default:
|
|
|
|
|
|
pageContent = appStyle.Render("无效页面")
|
|
|
|
|
|
}
|
|
|
|
|
|
return appStyle.Render(pageContent)
|
|
|
|
|
|
}
|
2026-02-21 20:22:21 +08:00
|
|
|
|
|
2026-02-27 22:52:15 +08:00
|
|
|
|
func makeRow(label, value string) string {
|
|
|
|
|
|
return lipgloss.JoinHorizontal(lipgloss.Left,
|
|
|
|
|
|
labelStyle.Render(label+":"),
|
|
|
|
|
|
valueStyle.Render(value),
|
|
|
|
|
|
)
|
2026-02-21 20:22:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-27 22:52:15 +08:00
|
|
|
|
func renderLicensePage(m model) string {
|
2026-02-22 20:18:12 +08:00
|
|
|
|
title := titleStyle.Render("SunHPC Software License Agreement")
|
2026-02-21 20:22:21 +08:00
|
|
|
|
|
2026-02-27 22:52:15 +08:00
|
|
|
|
licenseText := `
|
|
|
|
|
|
───────────────────────────────────────────────────────────────
|
2026-02-22 20:18:12 +08:00
|
|
|
|
1. License Grant
|
|
|
|
|
|
This software grants you a non-exclusive, non-transferable
|
|
|
|
|
|
license to use it.
|
|
|
|
|
|
2. Disclaimer of Warranties
|
|
|
|
|
|
This software is provided "as is" without any warranties,
|
|
|
|
|
|
whether express or implied.
|
|
|
|
|
|
3. Limitation of Liability
|
|
|
|
|
|
This software is provided without warranty of any kind,
|
|
|
|
|
|
either express or implied.
|
|
|
|
|
|
In no event shall the author be liable for any damages
|
|
|
|
|
|
arising out of the use of this software.
|
|
|
|
|
|
4. Termination of Agreement
|
|
|
|
|
|
If you violate any of the terms of this agreement,
|
|
|
|
|
|
the license will automatically terminate.
|
2026-02-21 20:22:21 +08:00
|
|
|
|
───────────────────────────────────────────────────────────────
|
2026-02-22 20:18:12 +08:00
|
|
|
|
PLEASE READ THE ABOVE TERMS CAREFULLY AND CLICK "ACCEPT"
|
|
|
|
|
|
TO AGREE AND FOLLOW THIS AGREEMENT.
|
2026-02-21 20:22:21 +08:00
|
|
|
|
───────────────────────────────────────────────────────────────
|
2026-02-27 22:52:15 +08:00
|
|
|
|
`
|
2026-02-21 20:22:21 +08:00
|
|
|
|
|
2026-02-27 22:52:15 +08:00
|
|
|
|
pageComps := m.pageComponents[PageAgreement]
|
|
|
|
|
|
acceptBtn := pageComps["accept_btn"].View()
|
|
|
|
|
|
rejectBtn := pageComps["reject_btn"].View()
|
2026-02-21 20:22:21 +08:00
|
|
|
|
|
|
|
|
|
|
// ✅ 添加调试信息(确认 agreementIdx 的值)
|
|
|
|
|
|
// debugInfo := lipgloss.NewStyle().Foreground(lipgloss.Color("#888888")).
|
|
|
|
|
|
// Render(fmt.Sprintf("[DEBUG: idx=%d]", m.agreementIdx),)
|
|
|
|
|
|
|
2026-02-27 22:52:15 +08:00
|
|
|
|
hint := hintStyle.Render("Use Left/Right OR Tab Change,Enter Confirm")
|
|
|
|
|
|
pageContent := lipgloss.JoinVertical(lipgloss.Center,
|
2026-02-21 20:22:21 +08:00
|
|
|
|
title, "",
|
2026-02-27 22:52:15 +08:00
|
|
|
|
licenseTextStyle.Render(licenseText),
|
|
|
|
|
|
lipgloss.JoinHorizontal(lipgloss.Center, acceptBtn, rejectBtn),
|
|
|
|
|
|
|
2026-02-21 20:22:21 +08:00
|
|
|
|
hint,
|
|
|
|
|
|
)
|
2026-02-27 22:52:15 +08:00
|
|
|
|
|
|
|
|
|
|
return appStyle.Render(pageContent)
|
2026-02-21 20:22:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-27 22:52:15 +08:00
|
|
|
|
// ---------------- 页2:基础信息页渲染 ----------------
|
|
|
|
|
|
func renderDataInfoPage(m model) string {
|
|
|
|
|
|
pageComps := m.pageComponents[PageData]
|
|
|
|
|
|
|
|
|
|
|
|
// 拼接基础信息表单
|
|
|
|
|
|
formContent := lipgloss.JoinVertical(lipgloss.Center,
|
|
|
|
|
|
split_line,
|
|
|
|
|
|
makeRow("Homepage", pageComps["Homepage_input"].View()),
|
|
|
|
|
|
split_line,
|
2026-02-28 19:29:17 +08:00
|
|
|
|
makeRow("ClusterName", pageComps["ClusterName_input"].View()),
|
2026-02-27 22:52:15 +08:00
|
|
|
|
split_line,
|
|
|
|
|
|
makeRow("Country", pageComps["Country_input"].View()),
|
|
|
|
|
|
split_line,
|
2026-03-06 00:29:34 +08:00
|
|
|
|
makeRow("State", pageComps["State_input"].View()),
|
2026-02-27 22:52:15 +08:00
|
|
|
|
split_line,
|
2026-03-06 00:29:34 +08:00
|
|
|
|
makeRow("City", pageComps["City_input"].View()),
|
|
|
|
|
|
split_line,
|
|
|
|
|
|
makeRow("Contact", pageComps["Contact_input"].View()),
|
2026-02-27 22:52:15 +08:00
|
|
|
|
split_line,
|
2026-03-06 00:29:34 +08:00
|
|
|
|
makeRow("Timezone", pageComps["Timezone_input"].View()),
|
2026-02-27 22:52:15 +08:00
|
|
|
|
split_line,
|
2026-03-06 00:29:34 +08:00
|
|
|
|
makeRow("DistroDir", pageComps["DistroDir_input"].View()),
|
2026-02-27 22:52:15 +08:00
|
|
|
|
split_line,
|
|
|
|
|
|
)
|
2026-02-21 20:22:21 +08:00
|
|
|
|
|
2026-02-27 22:52:15 +08:00
|
|
|
|
// 按钮区域
|
|
|
|
|
|
btnArea := lipgloss.JoinHorizontal(
|
|
|
|
|
|
lipgloss.Center,
|
|
|
|
|
|
pageComps["next_btn"].View(),
|
|
|
|
|
|
pageComps["prev_btn"].View(),
|
|
|
|
|
|
)
|
2026-02-21 20:22:21 +08:00
|
|
|
|
|
2026-02-27 22:52:15 +08:00
|
|
|
|
hint := hintStyle.Render("Use Left/Right OR Tab Change,Enter Confirm")
|
|
|
|
|
|
|
|
|
|
|
|
// 页面整体
|
|
|
|
|
|
pageContent := lipgloss.JoinVertical(
|
|
|
|
|
|
lipgloss.Center,
|
|
|
|
|
|
titleStyle.Render("基础信息配置(页2/6)"),
|
|
|
|
|
|
formContent,
|
|
|
|
|
|
btnArea,
|
2026-02-21 20:22:21 +08:00
|
|
|
|
hint,
|
|
|
|
|
|
)
|
2026-02-27 22:52:15 +08:00
|
|
|
|
|
|
|
|
|
|
return appStyle.Render(pageContent)
|
2026-02-21 20:22:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-27 22:52:15 +08:00
|
|
|
|
func renderPublicNetworkPage(m model) string {
|
|
|
|
|
|
pageComps := m.pageComponents[PagePublicNetwork]
|
|
|
|
|
|
|
|
|
|
|
|
// 拼接公网网络表单
|
|
|
|
|
|
formContent := lipgloss.JoinVertical(lipgloss.Center,
|
2026-03-06 00:29:34 +08:00
|
|
|
|
split_line,
|
|
|
|
|
|
makeRow("PublicHostname", pageComps["PublicHostname_input"].View()),
|
2026-02-27 22:52:15 +08:00
|
|
|
|
split_line,
|
|
|
|
|
|
makeRow("PublicInterface", pageComps["PublicInterface_input"].View()),
|
|
|
|
|
|
split_line,
|
|
|
|
|
|
makeRow("PublicIPAddress", pageComps["PublicIPAddress_input"].View()),
|
|
|
|
|
|
split_line,
|
|
|
|
|
|
makeRow("PublicNetmask", pageComps["PublicNetmask_input"].View()),
|
|
|
|
|
|
split_line,
|
|
|
|
|
|
makeRow("PublicGateway", pageComps["PublicGateway_input"].View()),
|
|
|
|
|
|
split_line,
|
2026-03-06 00:29:34 +08:00
|
|
|
|
makeRow("PublicDomain", pageComps["PublicDomain_input"].View()),
|
|
|
|
|
|
split_line,
|
2026-02-28 19:29:17 +08:00
|
|
|
|
makeRow("PublicMTU", pageComps["PublicMTU_input"].View()),
|
|
|
|
|
|
split_line,
|
2026-02-27 22:52:15 +08:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// 按钮区域
|
|
|
|
|
|
btnArea := lipgloss.JoinHorizontal(
|
|
|
|
|
|
lipgloss.Center,
|
|
|
|
|
|
pageComps["next_btn"].View(),
|
|
|
|
|
|
pageComps["prev_btn"].View(),
|
|
|
|
|
|
)
|
2026-02-21 20:22:21 +08:00
|
|
|
|
|
2026-02-22 20:18:12 +08:00
|
|
|
|
networkInterfaces := getNetworkInterfaces()
|
|
|
|
|
|
autoDetect := infoStyle.Render(
|
2026-02-27 22:52:15 +08:00
|
|
|
|
"[*] Auto Detect Interfaces: " + strings.Join(networkInterfaces, ", "))
|
2026-02-21 20:22:21 +08:00
|
|
|
|
|
2026-02-27 22:52:15 +08:00
|
|
|
|
hint := hintStyle.Render("Use Left/Right OR Tab Change,Enter Confirm")
|
2026-02-21 20:22:21 +08:00
|
|
|
|
|
2026-02-27 22:52:15 +08:00
|
|
|
|
// 页面整体
|
|
|
|
|
|
pageContent := lipgloss.JoinVertical(
|
|
|
|
|
|
lipgloss.Center,
|
|
|
|
|
|
titleStyle.Render("公网网络配置(页3/6)"),
|
|
|
|
|
|
autoDetect,
|
|
|
|
|
|
formContent,
|
|
|
|
|
|
btnArea,
|
2026-02-21 20:22:21 +08:00
|
|
|
|
hint,
|
|
|
|
|
|
)
|
|
|
|
|
|
|
2026-02-27 22:52:15 +08:00
|
|
|
|
return appStyle.Render(pageContent)
|
|
|
|
|
|
}
|
2026-02-22 20:18:12 +08:00
|
|
|
|
|
2026-02-27 22:52:15 +08:00
|
|
|
|
func renderInternalNetworkPage(m model) string {
|
|
|
|
|
|
pageComps := m.pageComponents[PageInternalNetwork]
|
|
|
|
|
|
|
|
|
|
|
|
// 拼接内网网络表单
|
|
|
|
|
|
formContent := lipgloss.JoinVertical(lipgloss.Center,
|
2026-03-06 00:29:34 +08:00
|
|
|
|
split_line,
|
|
|
|
|
|
makeRow("PrivateHostname", pageComps["PrivateHostname_input"].View()),
|
2026-02-27 22:52:15 +08:00
|
|
|
|
split_line,
|
2026-02-28 19:29:17 +08:00
|
|
|
|
makeRow("PrivateInterface", pageComps["PrivateInterface_input"].View()),
|
|
|
|
|
|
split_line,
|
|
|
|
|
|
makeRow("PrivateIPAddress", pageComps["PrivateIPAddress_input"].View()),
|
2026-02-27 22:52:15 +08:00
|
|
|
|
split_line,
|
2026-02-28 19:29:17 +08:00
|
|
|
|
makeRow("PrivateNetmask", pageComps["PrivateNetmask_input"].View()),
|
2026-02-27 22:52:15 +08:00
|
|
|
|
split_line,
|
2026-03-06 00:29:34 +08:00
|
|
|
|
makeRow("PrivateDomain", pageComps["PrivateDomain_input"].View()),
|
|
|
|
|
|
split_line,
|
2026-02-28 19:29:17 +08:00
|
|
|
|
makeRow("PrivateMTU", pageComps["PrivateMTU_input"].View()),
|
2026-02-27 22:52:15 +08:00
|
|
|
|
split_line,
|
|
|
|
|
|
)
|
2026-02-21 20:22:21 +08:00
|
|
|
|
|
2026-02-27 22:52:15 +08:00
|
|
|
|
// 按钮区域
|
|
|
|
|
|
btnArea := lipgloss.JoinHorizontal(
|
|
|
|
|
|
lipgloss.Center,
|
|
|
|
|
|
pageComps["next_btn"].View(),
|
|
|
|
|
|
pageComps["prev_btn"].View(),
|
|
|
|
|
|
)
|
2026-02-21 20:22:21 +08:00
|
|
|
|
|
2026-02-27 22:52:15 +08:00
|
|
|
|
hint := hintStyle.Render("Use Left/Right OR Tab Change,Enter Confirm")
|
2026-02-21 20:22:21 +08:00
|
|
|
|
|
2026-02-27 22:52:15 +08:00
|
|
|
|
// 页面整体
|
|
|
|
|
|
pageContent := lipgloss.JoinVertical(
|
|
|
|
|
|
lipgloss.Center,
|
|
|
|
|
|
titleStyle.Render("内网网络配置(页4/6)"),
|
|
|
|
|
|
formContent,
|
|
|
|
|
|
btnArea,
|
2026-02-21 20:22:21 +08:00
|
|
|
|
hint,
|
|
|
|
|
|
)
|
2026-02-27 22:52:15 +08:00
|
|
|
|
|
|
|
|
|
|
return appStyle.Render(pageContent)
|
2026-02-21 20:22:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-27 22:52:15 +08:00
|
|
|
|
func renderDNSPage(m model) string {
|
|
|
|
|
|
pageComps := m.pageComponents[PageDNS]
|
2026-02-21 20:22:21 +08:00
|
|
|
|
|
2026-02-27 22:52:15 +08:00
|
|
|
|
// 拼接 DNS 表单
|
|
|
|
|
|
formContent := lipgloss.JoinVertical(lipgloss.Center,
|
|
|
|
|
|
split_line,
|
|
|
|
|
|
makeRow("Pri DNS", pageComps["Pri_DNS_input"].View()),
|
|
|
|
|
|
split_line,
|
|
|
|
|
|
makeRow("Sec DNS", pageComps["Sec_DNS_input"].View()),
|
|
|
|
|
|
split_line,
|
|
|
|
|
|
)
|
2026-02-21 20:22:21 +08:00
|
|
|
|
|
2026-02-27 22:52:15 +08:00
|
|
|
|
// 按钮区域
|
|
|
|
|
|
btnArea := lipgloss.JoinHorizontal(
|
|
|
|
|
|
lipgloss.Center,
|
|
|
|
|
|
pageComps["next_btn"].View(),
|
|
|
|
|
|
pageComps["prev_btn"].View(),
|
|
|
|
|
|
)
|
2026-02-21 20:22:21 +08:00
|
|
|
|
|
2026-02-27 22:52:15 +08:00
|
|
|
|
hint := hintStyle.Render("Use Left/Right OR Tab Change,Enter Confirm")
|
|
|
|
|
|
|
|
|
|
|
|
// 页面整体
|
|
|
|
|
|
pageContent := lipgloss.JoinVertical(
|
|
|
|
|
|
lipgloss.Center,
|
|
|
|
|
|
titleStyle.Render("DNS 配置(页5/6)"),
|
|
|
|
|
|
formContent,
|
|
|
|
|
|
btnArea,
|
2026-02-21 20:22:21 +08:00
|
|
|
|
hint,
|
|
|
|
|
|
)
|
2026-02-27 22:52:15 +08:00
|
|
|
|
|
|
|
|
|
|
return appStyle.Render(pageContent)
|
2026-02-21 20:22:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-27 22:52:15 +08:00
|
|
|
|
func renderSummaryPage(m model) string {
|
|
|
|
|
|
pageComps := m.pageComponents[PageSummary]
|
|
|
|
|
|
|
|
|
|
|
|
// 拼接 Summary 表单
|
|
|
|
|
|
formContent := lipgloss.JoinVertical(lipgloss.Center,
|
|
|
|
|
|
split_line,
|
2026-02-28 19:29:17 +08:00
|
|
|
|
makeRow("ClusterName", m.config.ClusterName),
|
2026-02-27 22:52:15 +08:00
|
|
|
|
split_line,
|
|
|
|
|
|
makeRow("Country", m.config.Country),
|
|
|
|
|
|
split_line,
|
2026-03-06 00:29:34 +08:00
|
|
|
|
makeRow("State", m.config.State),
|
|
|
|
|
|
split_line,
|
|
|
|
|
|
makeRow("City", m.config.City),
|
|
|
|
|
|
split_line,
|
|
|
|
|
|
makeRow("Contact", m.config.Contact),
|
2026-02-27 22:52:15 +08:00
|
|
|
|
split_line,
|
|
|
|
|
|
makeRow("Timezone", m.config.Timezone),
|
|
|
|
|
|
split_line,
|
|
|
|
|
|
makeRow("Homepage", m.config.HomePage),
|
|
|
|
|
|
split_line,
|
|
|
|
|
|
makeRow("DBPath", m.config.DBAddress),
|
|
|
|
|
|
split_line,
|
2026-03-06 00:29:34 +08:00
|
|
|
|
makeRow("DistroDir", m.config.DistroDir),
|
2026-02-27 22:52:15 +08:00
|
|
|
|
split_line,
|
|
|
|
|
|
makeRow("PublicInterface", m.config.PublicInterface),
|
|
|
|
|
|
split_line,
|
|
|
|
|
|
makeRow("PublicIPAddress", m.config.PublicIPAddress),
|
|
|
|
|
|
split_line,
|
|
|
|
|
|
makeRow("PublicNetmask", m.config.PublicNetmask),
|
|
|
|
|
|
split_line,
|
|
|
|
|
|
makeRow("PublicGateway", m.config.PublicGateway),
|
|
|
|
|
|
split_line,
|
2026-02-28 19:29:17 +08:00
|
|
|
|
makeRow("PrivateInterface", m.config.PrivateInterface),
|
|
|
|
|
|
split_line,
|
|
|
|
|
|
makeRow("PrivateIPAddress", m.config.PrivateIPAddress),
|
2026-02-27 22:52:15 +08:00
|
|
|
|
split_line,
|
2026-02-28 19:29:17 +08:00
|
|
|
|
makeRow("PrivateNetmask", m.config.PrivateNetmask),
|
2026-02-27 22:52:15 +08:00
|
|
|
|
split_line,
|
2026-02-28 19:29:17 +08:00
|
|
|
|
makeRow("PrivateMTU", m.config.PrivateMTU),
|
2026-02-27 22:52:15 +08:00
|
|
|
|
split_line,
|
|
|
|
|
|
makeRow("Pri DNS", m.config.DNSPrimary),
|
|
|
|
|
|
split_line,
|
|
|
|
|
|
makeRow("Sec DNS", m.config.DNSSecondary),
|
|
|
|
|
|
split_line,
|
|
|
|
|
|
)
|
2026-02-21 20:22:21 +08:00
|
|
|
|
|
2026-02-27 22:52:15 +08:00
|
|
|
|
// 按钮区域
|
|
|
|
|
|
btnArea := lipgloss.JoinHorizontal(
|
|
|
|
|
|
lipgloss.Center,
|
|
|
|
|
|
pageComps["confirm_btn"].View(),
|
|
|
|
|
|
pageComps["cancel_btn"].View(),
|
|
|
|
|
|
)
|
2026-02-21 20:22:21 +08:00
|
|
|
|
|
2026-02-27 22:52:15 +08:00
|
|
|
|
hint := hintStyle.Render("Use Left/Right OR Tab Change,Enter Confirm")
|
|
|
|
|
|
|
|
|
|
|
|
// 页面整体
|
|
|
|
|
|
pageContent := lipgloss.JoinVertical(
|
|
|
|
|
|
lipgloss.Center,
|
|
|
|
|
|
titleStyle.Render("确认信息(页6/6)"),
|
|
|
|
|
|
formContent,
|
|
|
|
|
|
btnArea,
|
2026-02-21 20:22:21 +08:00
|
|
|
|
hint,
|
|
|
|
|
|
)
|
|
|
|
|
|
|
2026-02-27 22:52:15 +08:00
|
|
|
|
return appStyle.Render(pageContent)
|
2026-02-21 20:22:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func successView() string {
|
2026-02-27 22:52:15 +08:00
|
|
|
|
content := lipgloss.JoinVertical(lipgloss.Center,
|
2026-02-22 20:18:12 +08:00
|
|
|
|
successTitle.Render("Initialization Completed!"), "",
|
2026-02-27 22:52:15 +08:00
|
|
|
|
successMsg.Render(
|
|
|
|
|
|
"System configuration has been saved, and the system is initializing..."), "",
|
|
|
|
|
|
)
|
|
|
|
|
|
return appStyle.Render(content)
|
2026-02-21 20:22:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func quitView() string {
|
2026-02-27 22:52:15 +08:00
|
|
|
|
content := lipgloss.JoinVertical(lipgloss.Center,
|
2026-02-27 23:25:43 +08:00
|
|
|
|
split_line,
|
2026-02-22 20:18:12 +08:00
|
|
|
|
errorTitle.Render("Canceled"), "",
|
|
|
|
|
|
errorMsg.Render("Initialization canceled, no configuration saved"),
|
2026-02-27 23:25:43 +08:00
|
|
|
|
split_line,
|
|
|
|
|
|
"\n",
|
2026-02-27 22:52:15 +08:00
|
|
|
|
)
|
2026-02-27 23:25:43 +08:00
|
|
|
|
return quitStyle.Render(content)
|
2026-02-21 20:22:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func errorView(err error) string {
|
2026-02-27 22:52:15 +08:00
|
|
|
|
content := lipgloss.JoinVertical(lipgloss.Center,
|
2026-02-22 20:18:12 +08:00
|
|
|
|
errorTitle.Render("Error"), "",
|
2026-02-21 20:22:21 +08:00
|
|
|
|
errorMsg.Render(err.Error()), "",
|
2026-02-22 20:18:12 +08:00
|
|
|
|
hintStyle.Render("Press Ctrl+C to exit"),
|
2026-02-21 20:22:21 +08:00
|
|
|
|
)
|
2026-02-27 22:52:15 +08:00
|
|
|
|
return appStyle.Render(content)
|
2026-02-21 20:22:21 +08:00
|
|
|
|
}
|