Implement skeleton of UI

This commit is contained in:
The Magician 2024-05-27 12:15:42 +01:00
parent ce63add5c1
commit 3482ba70eb
2 changed files with 39 additions and 2 deletions

View File

@ -1,7 +1,17 @@
package main
import "fmt"
import (
"log"
"sevenkeys/ui"
tea "github.com/charmbracelet/bubbletea"
)
func main() {
fmt.Println("storage manager")
var model ui.StoragemgrModel
p := tea.NewProgram(model)
if _, err := p.Run(); err != nil {
log.Fatal(err)
}
}

27
sevenkeys/ui/model.go Normal file
View File

@ -0,0 +1,27 @@
package ui
import tea "github.com/charmbracelet/bubbletea"
type StoragemgrModel struct {
}
func (m StoragemgrModel) Init() tea.Cmd {
return nil
}
func (m StoragemgrModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
case tea.KeyMsg:
switch msg.String() {
case "ctrl+c":
return m, tea.Quit
}
}
return m, nil
}
func (m StoragemgrModel) View() string {
ui := "Hello, world\n"
return ui
}