manly
manly copied to clipboard
Manual manual parsing
It would be potentially better to grab the info from the manual pages directly instead of subproccing man, however we might still need to subproc man anyways to get paths
Notes
-
man -w
-> paths for man pages- works with man-db (fedora/debian/etc) and OpenBSD's implementation
for bonus points, implement man -w
yourself. most of the logic is in guess_manpath
: https://git.savannah.gnu.org/cgit/man-db.git/tree/src/manp.c#n665
you can see it in action via man -wd
Reimplementing 1400 lines of code of C to Python /can/ produce a short and beautiful program, but it is a lot of work and just a bit crazy. I would like to get rid of subprocess too. If anyone is crazy enough to attempt this, we also need to figure out how man differs on bsd...
you don't need to handle most of the cases (like when PATH
is empty or unset). just
- read
/etc/manpath.config
- build a
PATH
→MANPATH
dict - search the
PATH
and pull out all the relevantMANPATH
s - add the
MANDATORY_MANPATH
s - ignore BSD because who cares