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

elaborate that npm help uses browser #2502

Closed
wants to merge 1 commit into from

Conversation

@ariccio
Copy link
Contributor

@ariccio ariccio commented Jan 16, 2021

As I mentioned in issue #2501 it is is mildly annoying to me that I forget that the npm help command opens a browser, and probably a few other people.

I have added "(in a browser)" to the npm usage string at the npm help line. Is this a reasonable change? It makes the output slightly more verbose, but reduces the occasional surprise of opening a browser with a saved session of over 900 tabs just to view a single help page. Yes, really, I do have 1004 tabs open currently, and that's an outlier, but I'm sure this impacts other people in less unusual circumstances.

References

Fixes #2501

As I mentioned in issue npm#2501 this is mildly annoying to me, and probably a few other people. I have added "(in a browser)" to the npm usage string at the npm help line.
@ariccio ariccio requested a review from as a code owner Jan 16, 2021
@wraithgar
Copy link
Contributor

@wraithgar wraithgar commented Jan 19, 2021

npm help only opens in a browser (by default) on windows, because there is no man command in windows. This is driven by the config value of viewer which is set to browser in windows, and man in osx and linux.

At the very least we would want to make sure to indicate that this is only the default in windows. Not sure how to do that succinctly off the top of my head.

@ljharb
Copy link
Collaborator

@ljharb ljharb commented Jan 19, 2021

@wraithgar maybe include npm config get viewer dynamically in the help output?

Copy link
Contributor

@ruyadorno ruyadorno left a comment

We already have this explained as part of npm help help.

We can not land this as-is for the reasons @wraithgar just mentioned but maybe it's worth exploring the solution from @ljharb, I'm not 100% sure about having a conditional in usage messages but if that's feasible then it may even keep this (in a browser) value in windows-only.

@ariccio
Copy link
Contributor Author

@ariccio ariccio commented Jan 21, 2021

It might be very reasonable to display this on windows only! I like that idea, but (of course) that makes this a non-trivial change. What's the best way to do that?

@wraithgar
Copy link
Contributor

@wraithgar wraithgar commented Jan 21, 2021

I believe that when this file is loaded the config is already loaded. You could gate the extra output behind a conditional that checks if viewer is set to browser.

@ljharb
Copy link
Collaborator

@ljharb ljharb commented Jan 21, 2021

This approach has the benefit of matching "the current config", including if a user overrode it.

isaacs added a commit that referenced this issue Feb 1, 2021
As I mentioned in issue #2501 this is mildly annoying to me, and probably a few other people. I have added "(in a browser)" to the npm usage string at the npm help line.

PR-URL: #2502
Credit: @ariccio
Close: #2502
Reviewed-by: @isaacs
@isaacs isaacs mentioned this pull request Feb 1, 2021
@isaacs isaacs closed this in 13a5e31 Feb 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

5 participants