;doc: pager: note that help -p TOPIC uses less

This commit is contained in:
Simon Michael 2024-11-01 08:15:09 -10:00
parent 234b4879c2
commit 66953ae0be
2 changed files with 7 additions and 3 deletions

View File

@ -109,9 +109,11 @@ runInfoForTopic tool mtopic =
-- less with any vertical whitespace squashed, case-insensitive searching, the $ regex metacharacter accessible as \$.
less = "less -s -i --use-backslash"
-- XXX should use the more robust Hledger.Utils.IO.runPager.
-- | Display plain text help for this tool, scrolled to the given topic if any, using the users $PAGER or "less".
-- When a topic is provided we always use less, ignoring $PAGER.
--
-- This is less robust than the newer Hledger.Utils.IO.runPager,
-- but that one doesn't yet support scrolling to a topic.
runPagerForTopic :: Tool -> Maybe Topic -> IO ()
runPagerForTopic tool mtopic = do
withSystemTempFile ("hledger-"++tool++".txt") $ \f h -> do

View File

@ -767,9 +767,11 @@ While it is active, usually `SPACE` shows the next page, `h` shows help, and `q`
The home/end/page up/page down/cursor keys, and mouse scrolling, may also work.
hledger will use the pager specified by the `PAGER` environment variable, otherwise `less` if available, otherwise `more` if available.
(With one exception: `hledger help -p TOPIC` will always use `less`, so that it can scroll to the topic.)
The pager is expected to display hledger's ANSI colour and text styling.
(If you use a pager other than `less`, you might need to configure it to handle this.
Or you could disable colour as described above.)
If you see junk characters, you might need to configure your pager to handle ANSI codes.
Or you could disable colour as described above.
If you are using the `less` pager, hledger automatically appends a number of options to
the `LESS` variable to enable ANSI colour and a number of other conveniences.