Sets up Go module, Wish/BubbleTea SSH server on port 2222, placeholder TUI model showing "Welcome to Catacombs!", Dockerfile, and docker-compose. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
49 lines
810 B
Go
49 lines
810 B
Go
package ui
|
|
|
|
import (
|
|
tea "github.com/charmbracelet/bubbletea"
|
|
)
|
|
|
|
type screen int
|
|
|
|
const (
|
|
screenTitle screen = iota
|
|
)
|
|
|
|
type Model struct {
|
|
width int
|
|
height int
|
|
fingerprint string
|
|
screen screen
|
|
}
|
|
|
|
func NewModel(width, height int, fingerprint string) Model {
|
|
return Model{
|
|
width: width,
|
|
height: height,
|
|
fingerprint: fingerprint,
|
|
screen: screenTitle,
|
|
}
|
|
}
|
|
|
|
func (m Model) Init() tea.Cmd {
|
|
return nil
|
|
}
|
|
|
|
func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|
switch msg := msg.(type) {
|
|
case tea.KeyMsg:
|
|
if msg.String() == "q" || msg.String() == "ctrl+c" {
|
|
return m, tea.Quit
|
|
}
|
|
case tea.WindowSizeMsg:
|
|
m.width = msg.Width
|
|
m.height = msg.Height
|
|
}
|
|
return m, nil
|
|
}
|
|
|
|
func (m Model) View() string {
|
|
return "Welcome to Catacombs!\n\nPress q to quit."
|
|
}
|