fallback pager

trunk
nbsp 2025-01-07 02:27:58 +02:00
parent 3f11ec07c8
commit a73a4a78b1
No known key found for this signature in database
GPG Key ID: 7184AC1C9835CE48
1 changed files with 5 additions and 1 deletions

View File

@ -86,7 +86,11 @@ func showPost(state *ui.State, post ttbp.Post) {
vt.TERM = os.Getenv("TERM") vt.TERM = os.Getenv("TERM")
vt.Attach(state.PostEvent()) vt.Attach(state.PostEvent())
vt.Focus() vt.Focus()
err := vt.Start(exec.Command(os.ExpandEnv(os.Getenv("PAGER")), path.Join("/home", post.Author, ".ttbp/entries", post.Date.Format("20060102")+".txt"))) pager := os.ExpandEnv(os.Getenv("PAGER"))
if pager == "" {
pager = "less"
}
err := vt.Start(exec.Command(pager, path.Join("/home", post.Author, ".ttbp/entries", post.Date.Format("20060102")+".txt")))
if err != nil { if err != nil {
panic(err) panic(err)
} }