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-12 17:05:16 -04:00
|
|
|
"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()
|
2020-05-12 17:56:30 -04:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
}
|