Skip to content
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

Manual manual parsing #26

Open
Summertime opened this issue Nov 12, 2018 · 3 comments
Open

Manual manual parsing #26

Summertime opened this issue Nov 12, 2018 · 3 comments

Comments

@Summertime
Copy link
Collaborator

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

  1. man -w -> paths for man pages
    • works with man-db (fedora/debian/etc) and OpenBSD's implementation
@raylu
Copy link
Collaborator

raylu commented Nov 12, 2018

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

@carlbordum
Copy link
Owner

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...

@raylu
Copy link
Collaborator

raylu commented Nov 12, 2018

you don't need to handle most of the cases (like when PATH is empty or unset). just

  1. read /etc/manpath.config
  2. build a PATHMANPATH dict
  3. search the PATH and pull out all the relevant MANPATHs
  4. add the MANDATORY_MANPATHs
  5. ignore BSD because who cares

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants