feat: project scaffold with SSH server and placeholder TUI
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>
This commit is contained in:
48
ui/model.go
Normal file
48
ui/model.go
Normal file
@@ -0,0 +1,48 @@
|
||||
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."
|
||||
}
|
||||
Reference in New Issue
Block a user