fallback pager
parent
3f11ec07c8
commit
a73a4a78b1
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue