added encryption and disk selection

This commit is contained in:
tumillanino
2025-10-28 22:51:28 +11:00
parent 8f054b63a1
commit 6f1a6f6efa
5 changed files with 217 additions and 18 deletions

View File

@@ -19,16 +19,16 @@ func (i Disk) Description() string { return i.description }
type ItemDelegate struct{}
func (i ItemDelegate) Height() int { return 1 }
func (i ItemDelegate) Width() int { return 0 }
func (i ItemDelegate) Update(msg tea.Msg, m list.Model) tea.Cmd { return nil }
func (i ItemDelegate) Render(w io.Writer, m list.Model, index int, item list.Item) {
i, ok := item.(Disk)
func (i ItemDelegate) Height() int { return 1 }
func (i ItemDelegate) Spacing() int { return 0 }
func (i ItemDelegate) Update(msg tea.Msg, m *list.Model) tea.Cmd { return nil }
func (d ItemDelegate) Render(w io.Writer, m list.Model, index int, item list.Item) {
disk, ok := item.(Disk)
if !ok {
return
}
s := fmt.Sprintf("%d. %s - %s", index+1, i.Title(), i.Description())
s := fmt.Sprintf("%d. %s - %s", index+1, disk.Title(), disk.Description())
// focus styles
if index == m.Index() {
@@ -53,12 +53,11 @@ func NewDiskSelModel(width, height int) DiskSelModel {
Disk{name: "/dev/loop0", description: "2GB Fanxiang SSD"},
}
l := list.New(disks, itemDelegate{}, width, height-5)
l.Title = styles.TitleStyle.Render("Select Installation Disk")
l := list.New(disks, ItemDelegate{}, width, height-5)
l.Title = "Select Installation Disk"
l.SetShowStatusBar(false)
l.SetFilterEnabled(false)
l.SetFilteringEnabled(false)
l.Styles.Title = styles.TitleStyle
l.KeyMap.Unbind()
return DiskSelModel{list: l}
}