bubbletea/examples/pager/main.go

30 lines
488 B
Go
Raw Normal View History

2020-05-11 21:03:04 -04:00
package main
import (
"fmt"
"io/ioutil"
"os"
2020-05-12 16:39:08 -04:00
"github.com/charmbracelet/boba"
"github.com/charmbracelet/boba/pager"
2020-05-11 21:03:04 -04:00
)
func main() {
content, err := ioutil.ReadFile("artichoke.md")
if err != nil {
fmt.Println("could not load file:", err)
os.Exit(1)
}
2020-05-12 16:39:08 -04:00
boba.AltScreen()
defer boba.ExitAltScreen()
if err := boba.NewProgram(
pager.Init(string(content)),
pager.Update,
pager.View,
).Start(); err != nil {
2020-05-11 21:03:04 -04:00
fmt.Println("could not run program:", err)
os.Exit(1)
}
}