Hacker News new | ask | show | jobs
by sicromoft 2167 days ago
Note that this doesn't work on macOS, where the builtin `man` command doesn't support the `-l` option.
1 comments

Ah interesting, is there any workaround for Mac? Otherwise, I may just have to fallback to stripping the man page formatting and sending it to less.
The actual `man` command does this:

    /usr/bin/tbl | /usr/bin/groff -Wall -mtty-char -Tascii -mandoc -c | /usr/bin/less -is
So you could do it "manually" that way. Not the cleanest or prettiest solution but it's much lighter weight than using something like pandoc.

EDIT: Full example:

    { /usr/bin/tbl | /usr/bin/groff -Wall -mtty-char -Tascii -mandoc -c | /usr/bin/less -is; } <<EOF
    .\" Manpage for encpass.sh.
    .\" Email contact@plyint.com to correct errors or typos.
    .TH man 8 "06 March 2020" "1.0" "encpass.sh man page"
    .SH NAME
    encpass.sh \- Use encrypted passwords in shell scripts
    ...
    EOF
Thanks, this worked well on Mac.
If I understand your need correctly: pandoc.
pandoc is not installed on macOS out-of-the-box though right? The user would have to pull via homebrew or something?
> is there any workaround for Mac?

Yeah, any regular unix will do, for example openbsd, freebsd or any linux distribution.