diff options
author | Tim Culverhouse <tim@timculverhouse.com> | 2022-10-28 12:20:21 -0500 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2022-11-06 23:17:48 +0100 |
commit | 2cbcdf3175211fdbb7c36f37ea5254c5e6ffe79d (patch) | |
tree | 68a5ddc146e642364e7bd3d5f81dbbe358281f02 /widgets | |
parent | 229e7b68af38c2dda37a3191c0f70f5d2e872294 (diff) | |
download | aerc-2cbcdf3175211fdbb7c36f37ea5254c5e6ffe79d.tar.gz |
msgviewer: warn user when pager is not in PATH
Warn user when configured pager is not in PATH. Attempt fallbacks, and
throw error if none of the fallbacks are in PATH.
Fixes: https://todo.sr.ht/~rjarry/aerc/94
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/msgviewer.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/widgets/msgviewer.go b/widgets/msgviewer.go index 7365dc53..837c0608 100644 --- a/widgets/msgviewer.go +++ b/widgets/msgviewer.go @@ -529,7 +529,17 @@ func NewPartViewer(acct *AccountView, conf *config.AercConfig, pagerin io.WriteCloser term *Terminal ) - cmd, err := shlex.Split(conf.Viewer.Pager) + cmds := []string{ + conf.Viewer.Pager, + os.Getenv("PAGER"), + "less -R", + } + pagerCmd, err := acct.aerc.CmdFallbackSearch(cmds) + if err != nil { + acct.PushError(fmt.Errorf("could not start pager: %w", err)) + return nil, err + } + cmd, err := shlex.Split(pagerCmd) if err != nil { return nil, err } |