diff --git a/docs/lib/content/commands/npm-completion.md b/docs/lib/content/commands/npm-completion.md index dcc25997fa585..180200193fd44 100644 --- a/docs/lib/content/commands/npm-completion.md +++ b/docs/lib/content/commands/npm-completion.md @@ -10,19 +10,24 @@ description: Tab Completion for npm ### Description -Enables tab-completion in all npm commands. +Generates a shell script to enable tab-completion for all npm commands. -The synopsis above -loads the completions into your current shell. Adding it to +To load the completions into your current shell: + +```bash +source <(npm completion) +``` + +Adding this to your ~/.bashrc or ~/.zshrc will make the completions available everywhere: ```bash -npm completion >> ~/.bashrc -npm completion >> ~/.zshrc +echo 'source <(npm completion)' >> ~/.bashrc +echo 'source <(npm completion)' >> ~/.zshrc ``` -You may of course also pipe the output of `npm completion` to a file +You may of course instead add `source <(npm completion)` to a file such as `/usr/local/etc/bash_completion.d/npm` or `/etc/bash_completion.d/npm` if you have a system that will read that file for you.