Gim/cmd/gim/main.go
Hayden Hargreaves ccb061989a refactor: huge refactor, this looks amazing.
Lots of comments from the AI. Some tests are not passing though
2026-03-04 21:45:47 -07:00

40 lines
928 B
Go

package main
import (
"fmt"
"git.gophernest.net/azpect/TextEditor/internal/core"
"git.gophernest.net/azpect/TextEditor/internal/editor"
tea "github.com/charmbracelet/bubbletea"
)
// main: Entry point for the Gim text editor. Creates a buffer and window,
// initializes the editor model, and runs the BubbleTea TUI program.
func main() {
buf := core.NewBufferBuilder().
Build()
win := core.NewWindowBuilder().
WithBuffer(&buf).
Build()
model := editor.NewModelBuilder().
AddBuffer(&buf).
AddWindow(&win).
WithActiveWindowId(win.Id).
Build()
m, _ := tea.NewProgram(model, tea.WithAltScreen()).Run()
final, ok := m.(*editor.Model)
if ok {
fmt.Printf("PRINTING WINDOWS: %+v\n", final.Windows())
fmt.Printf("PRINTING ACTIVE WINDOW: %+v\n", final.ActiveWindow())
for _, win := range final.Windows() {
fmt.Printf("\t%+v\n", *win.Buffer)
}
} else {
fmt.Printf("PRINTING ALL: %+v\n", m)
}
}