mirror of
https://github.com/taigrr/bubbletea.git
synced 2026-04-02 02:59:09 -07:00
It was a valiant effort, and the implementation was solid and dependable, but at the end of the day we can achieve the same functionality in a much simpler fashion with commands, especially because Go is not held to the same restrictions as Elm.
30 lines
488 B
Go
30 lines
488 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"io/ioutil"
|
|
"os"
|
|
|
|
"github.com/charmbracelet/boba"
|
|
"github.com/charmbracelet/boba/pager"
|
|
)
|
|
|
|
func main() {
|
|
content, err := ioutil.ReadFile("artichoke.md")
|
|
if err != nil {
|
|
fmt.Println("could not load file:", err)
|
|
os.Exit(1)
|
|
}
|
|
|
|
boba.AltScreen()
|
|
defer boba.ExitAltScreen()
|
|
if err := boba.NewProgram(
|
|
pager.Init(string(content)),
|
|
pager.Update,
|
|
pager.View,
|
|
).Start(); err != nil {
|
|
fmt.Println("could not run program:", err)
|
|
os.Exit(1)
|
|
}
|
|
}
|