bubbletea/examples/pager/main.go

26 lines
445 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"
2020-05-11 21:03:04 -04:00
"github.com/charmbracelet/teaparty/pager"
)
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()
2020-05-11 21:03:04 -04:00
if err := pager.NewProgram(string(content)).Start(); err != nil {
fmt.Println("could not run program:", err)
os.Exit(1)
}
}