-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MANPAGER won't work on Mandoc's man implementation #1145
Comments
Thank you for reporting this. This is not a bug in |
It does not work because mandoc does not do shell tokenization of the
|
Not that performance matters much for a shell script like this, but you can even cut out the cat invocation: col -bx < "$1" | bat --language man -p |
If you don't have |
Or: #!/bin/sh
exec col -bx | bat -pl man |
These two commands are not equivalent - the former reads from a file denoted by #!/bin/sh
# mandoc passes a file name, other tools write to stdout
# using `cat "$@"` we take care of both reading from file and stdin
exec cat "$@" | col -bx | bat --language man --style plain --pager "$PAGER" |
@lahwaacz Thanks, this solution works wonderfully! |
As part of my investigation into other man-related issues, I figured out why the It does extremely simple shell splitting for the @lahwaacz's approach of putting it in a separate script is the only solution to having this work with |
Or this for better performance: #!/bin/sh
if [ -f "$1" ]; then
col -bx < "$1" | bat --language man --plain
else
col -bx | bat --language man --plain
fi |
Did you actually measure it? In any case, |
what else is the
Do I have to? One must be processed through |
You should not check if
And you have added one shell condition instead. What do you think is faster: |
Hey, so you have so much free time in your life huh? It just bothered me when you don't understand the code and saying it's wrong. It's not wrong. See, after you figure out what my code means, you already improve it. Good learning for you, right? 😉 #!/bin/sh
if [ $# -eq 0 ]; then
col -bx | "$BAT_BIN" --language man --plain
else
col -bx < "$1" | "$BAT_BIN" --language man --plain
fi
Isn't it obvious? But sure, have it your way.. I don't have much time and energy for something like this For others: In ubuntu, |
Yeah it is much easier to claim something without actually verifying that it is true. I can as easily claim that there is no actual benefit in terms of performance. |
You are all the way right 😉 |
What version of
bat
are you using?0.15.4
Describe the bug you encountered:
Using
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
results in
-bx: 1: Syntax error: Unterminated quoted string
Describe what you expected to happen?
paging with bat
How did you install
bat
?Void Linux package manager
** The bug **
It was already reported here for Termux, and it coudl well be the case for Alpine and other Mandoc's man implementations cases.
See termux/termux-packages#4781 (comment)
** Lazy solution **
Instead of recompiling man from GNU (https://www.nongnu.org/man-db/development.html)
one can be using
export MANPAGER='nvim +Man!'
The text was updated successfully, but these errors were encountered: