Correct some writing and add check for unknown/unsupported bootloader

This commit is contained in:
HikariKnight 2023-04-12 14:28:13 +02:00
parent 756f974071
commit 5a1e4c78ed
2 changed files with 12 additions and 2 deletions

View file

@ -72,7 +72,7 @@ func (m *model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
// Blank the password field // Blank the password field
m.authDialog.SetValue("") m.authDialog.SetValue("")
fmt.Println("Working... Application frozen until done, check debug.log for progress") fmt.Println(titleStyle.Render("Working... Application frozen until done, check debug.log for progress"))
// Start installation and send the password to the command // Start installation and send the password to the command
m.install() m.install()

View file

@ -6,6 +6,8 @@ import (
"path/filepath" "path/filepath"
"strings" "strings"
"github.com/HikariKnight/quickpassthrough/internal/configs"
"github.com/HikariKnight/quickpassthrough/pkg/fileio"
tea "github.com/charmbracelet/bubbletea" tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss" "github.com/charmbracelet/lipgloss"
) )
@ -147,8 +149,16 @@ func (m model) View() string {
tea.Batch() tea.Batch()
case DONE: case DONE:
title = titleStyle.Render("Applying configurations!") title = titleStyle.Render("Applied configurations!")
view = dialogStyle.Render(fmt.Sprintf("%s\n\nPress Enter to Exit.", strings.Join(m.installOutput, "\n"))) view = dialogStyle.Render(fmt.Sprintf("%s\n\nPress Enter to Exit.", strings.Join(m.installOutput, "\n")))
// If the bootloader is unknown/unsupported
config := configs.GetConfig()
if config.Bootloader == "unknown" {
// Change the view to reflect that
view = dialogStyle.Render(fmt.Sprintf("%s\n\nI do not have a good way to reliably edit your bootloader!\nPlease add: %s\nTo your bootloaders kernel arguments.\nPress Enter to Exit.", strings.Join(m.installOutput, "\n"), fileio.ReadFile(config.Path.CMDLINE)))
}
} }
//return listStyle.SetString(fmt.Sprintf("%s\n\n", title)).Render(m.lists[m.focused].View()) //return listStyle.SetString(fmt.Sprintf("%s\n\n", title)).Render(m.lists[m.focused].View())
return lipgloss.JoinVertical(lipgloss.Left, fmt.Sprintf("%s\n%s\n", title, view)) return lipgloss.JoinVertical(lipgloss.Left, fmt.Sprintf("%s\n%s\n", title, view))