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 a team as a code owner January 16, 2021 22:33
@wraithgar
Copy link
Member

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 commented Jan 19, 2021

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

@darcyclarke darcyclarke added Release 7.x work is associated with a specific npm 7 release release: next These items should be addressed in the next release semver:patch semver patch level for changes labels Jan 20, 2021
Copy link
Collaborator

@ruyadorno ruyadorno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@ruyadorno ruyadorno removed the release: next These items should be addressed in the next release label Jan 21, 2021
@ariccio
Copy link
Contributor Author

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
Member

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 commented Jan 21, 2021

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

@ruyadorno ruyadorno added the pr: needs tests requires tests before merging label Feb 1, 2021
isaacs pushed a commit that referenced this pull request 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
@ruyadorno ruyadorno removed the pr: needs tests requires tests before merging label Feb 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Release 7.x work is associated with a specific npm 7 release semver:patch semver patch level for changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

npm usage should explain that it will open in a browser
5 participants