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

support for man pages #195

Open
DerekNonGeneric opened this issue Sep 7, 2022 · 5 comments
Open

support for man pages #195

DerekNonGeneric opened this issue Sep 7, 2022 · 5 comments
Labels
enhancement New feature or request

Comments

@DerekNonGeneric
Copy link

It does not seem like there is currently support for man pages. For example, running man npm should pull up the man page for the npm command and all the other globally-installed npm packages that include man pages. It currently works for the node command, but not npm. I think that should be the responsibility of this script, but I might be wrong.

If this is something that should be set by the user in a config.fish file or Dockerfile, let me know, and we can close this. I just think it would be convenient for this script to handle that. You can check out this config.fish I wrote a really long time ago that accounted for this (used this before using nvm at all).

See: https://docs.npmjs.com/cli/v8/configuring-npm/folders#man-pages

@jorgebucaran jorgebucaran added the enhancement New feature or request label Feb 24, 2023
@jorgebucaran
Copy link
Owner

jorgebucaran commented Feb 24, 2023

You are right, man npm pulls up the man page for the system node, not the version managed by nvm.

Edit: Typo

@DerekNonGeneric
Copy link
Author

You are right, man nom pulls up the man page for the system node, not the version managed by nvm.

You probably mean man npm, but yeah, so confirmed bug i guess -- i would like it fixed too :)

@DerekNonGeneric
Copy link
Author

whereis-note

The following may be helpful in the meantime, but will let you know about any progress (can make a PR too).

@jorgebucaran
Copy link
Owner

I might have a potential fix for this, but I'm currently stuck because of an issue with Fish that breaks man for other commands after updating $MANPATH.

Here's the code to support man npm:

contains -- $nvm_data/$ver/lib/node_modules/npm/man $MANPATH ||
    set --global --prepend MANPATH $nvm_data/$ver/lib/node_modules/npm/man

And to remove it:

set --local man_index (contains --index -- $nvm_data/$ver/lib/node_modules/npm/man $MANPATH) &&
    set --erase MANPATH[$man_index]

Related: fish-shell/fish-shell#2090.

@faho
Copy link

faho commented Apr 29, 2023

In short: Have a look at https://github.com/fish-shell/fish-shell/blob/a9708367db7bd15f28802c12ac947c2e354a98ea/share/functions/man.fish#L11-L29.

breaks man for other commands after updating $MANPATH

The usual case is that $MANPATH is unset, in which case man will use the system's default.

Once you set it, only that will be used.

How you get it to use your directory in addition to the system path unfortunately depends on your man implementation (man is extremely unstandardized - there are a ton of implementations, and they work differently).

Common ideas are:

  • An empty component means "system path here" - common on linux
  • You have a man -p option or a manpath program that can print the default (common on BSDs)

This is down to man, not fish.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants