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

[RRFC] Add method for getting help on config option #313

Open
Yash-Singh1 opened this issue Feb 4, 2021 · 2 comments
Open

[RRFC] Add method for getting help on config option #313

Yash-Singh1 opened this issue Feb 4, 2021 · 2 comments

Comments

@Yash-Singh1
Copy link
Contributor

Yash-Singh1 commented Feb 4, 2021

Motivation ("The Why")

Some configuration keys are not self-explanatory by their name. This will require someone to search up the configuration name online. A faster and simpler way that can even work offline would be to add in a help method on the npm config command in the CLI. I am aware of the npm help 7 config command, but that gives extra information for each configuration key. A method to get the help output for a single configuration key would be much more useful.

Example

$ npm config help also

- Default: null
- Type: String

When "dev" or "development" and running local npm shrinkwrap, npm outdated, or npm update, is an alias for --dev.

$ npm config help init-author-name

- Default: ""
- Type: String

The value npm init should use by default for the package author's name.

$ npm config help loglevel

- Default: "notice"
- Type: String
- Values: "silent", "error", "warn", "notice", "http", "timing", "info", "verbose", "silly"

What level of logs to report. On failure, all logs are written to npm-debug.log in the current working directory.

Any logs of a higher level than the setting are shown. The default is "notice".

$ npm config --help

npm config set <key> <value>
npm config get [<key>]
npm config delete <key>
npm config help <key>
npm config list [--json]
npm config edit
npm set <key> <value>
npm get [<key>]

alias: c

As seen above, the help output gives details on the key.

How

  • Store the help output that will have to be returned for each key
  • Log the output when the CLI asks for it

Current Behaviour

No help command on config.

Desired Behaviour

There is a help command on config.

References

@isaacs
Copy link
Contributor

isaacs commented Mar 3, 2021

I want to add this, but it'll require some refactoring of our config system (which is already in progress, for other reasons!)

I don't think it needs to be an RFC, it's a pretty straightforward enhancement with no real downsides, as far as I can tell.

@isaacs
Copy link
Contributor

isaacs commented Mar 3, 2021

Oh, maybe we should bikeshed it a little bit though? I'd prefer to just say that any known config value will effectively be a top-level help option. So you'd do npm help user-agent and get the help topic on the user-agent config.

@darcyclarke darcyclarke removed the Agenda will be discussed at the Open RFC call label Mar 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants