I made this function to be able to render manpages with bat -lman --pager=most
, but compile it with GROFF instead of mandoc(1)
.
It's very easy to prepare mandoc(1)
-compiled manpages with bat(1)
. All you have to do is to filter it through col -xb
.
But GROFF uses ESC[..;word ESC[...
sequences (aka ANSI) so it's a bit hard.
My Fish function deansify
takes a file either via STDIN or --file/-f
and da-ANSI-fies it tou STDOUT.
Pretty simple. Now you can do zcat (man -w <manpage>) | groff -man -Tascii | deansify | bat -lman --pager=most
(I highly recommend using most(1)
as your default pager!).
So anyways here it is. It's not worth a separate file.
function deansify
argparse -n greet 'f/file=' -- $argv
or return 1
set -l fpath '/dev/stdin'
if set -q _flag_file
set fpath $_flag_file
end
cat $fpath | sed 's/\x1B\[[0-9;]*[a-zA-Z]//g'
end
PS1: I have over 70 projects on my Github frontpage. My repositores are word a peruse as well: https://github.com/Chubek
Xbox30: I am currently working on an LL(1) parser/lexer generator in Perl: https://gist.github.com/Chubek/294547e247061bbaccf04e0377425a90
NES: I am also working on YoreUtils
which, like CoreUtils and MoreUtils, is a collection of 'filters'. I have not decided what language to do it in yet :(