aitjcize / cppman

C++ 98/11/14 manual pages for Linux/MacOS
GNU General Public License v3.0
1.27k stars 79 forks source link

update_mandb_path() and config.UpdateManPath #74

Closed belkka closed 5 years ago

belkka commented 6 years ago

The function cppmap.util.update_mandb_path() is used only once in the code:

https://github.com/aitjcize/cppman/blob/841fc75bd501da448ce93750d059a16eecaac2d4/bin/cppman#L149

# from bin/cppman:
        if config.UpdateManPath:  # bool variable
            update_mandb_path()

But the function itself checks the value of config.UpdateManPath and removes some strings from the file ~/.manpath when it is False

Something is wrong. We need either

jep-dev commented 6 years ago

I'm not sure if this is related to my issue, but it certainly seems like it would be. After downloading/caching/updating my mandb, I am able to use man std::string to view its manpage, and even autocomplete man std::string<tab> in bash and zsh, but man -k std::string returns std::string: nothing appropriate. Manually exporting MANPATH with appended $HOME/.local/share/man and/or subdirectories has no effect, despite showing up in manpath's output. To be sure, man -k vector returns nothing relevant and man -k ^std returns only entries from stdio.h, while both complete the way you'd expect.

If this isn't solved or easily solvable at this time, I can come up with a workaround. For now, completions are working well enough, e.g. man s<tab>ng::string -> man std::string::string, but neither globs nor regex will, so you can't find string's constructor with man s\*ng::s\*ng, man s*ng::s*ng, apropos -r 's.*ng::s.*ng', etc.

SGSSGene commented 5 years ago

These two problems are only very little related.

@belkka the issue you are mentioning certainly exists cppman -m false doesn't unregister the path properly. In general there seems to be an issue with the folders. Everything should be located in ~/.cache/cppman and not ~/.local/share/man Besides removing an entry from ~/.manpath also the removal of the man3 is missing (which would not be necessary if it is stored in .cache/cppman).

@jep-dev The problem that I see here is that mandb doesn't create indexed entries for ~/.local/share/man. To solve this issue there needs to be an MANDB_MAP entry in .manpath. Like this:

MANDATORY_MANPATH       /home/sgssgene/.local/share/man
MANDB_MAP               /home/sgssgene/.local/share/man  /home/sgssgene/.local/share/manindex
aitjcize commented 5 years ago

Fixed by PR #88