diff --git a/hledger/Hledger/Cli/DocFiles.hs b/hledger/Hledger/Cli/DocFiles.hs index 7a9b4af31..3b98ef609 100644 --- a/hledger/Hledger/Cli/DocFiles.hs +++ b/hledger/Hledger/Cli/DocFiles.hs @@ -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 diff --git a/hledger/hledger.m4.md b/hledger/hledger.m4.md index 7e8107d5d..3966b4110 100644 --- a/hledger/hledger.m4.md +++ b/hledger/hledger.m4.md @@ -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.