2019-11-05 14:55:08 -05:00
|
|
|
---
|
|
|
|
title: npm-completion
|
2020-11-01 07:54:36 +01:00
|
|
|
section: 1
|
2019-11-05 14:55:08 -05:00
|
|
|
description: Tab Completion for npm
|
|
|
|
---
|
2011-11-21 09:48:45 -08:00
|
|
|
|
2019-11-05 14:55:08 -05:00
|
|
|
### Synopsis
|
2020-10-20 17:02:27 -04:00
|
|
|
|
2019-11-05 14:55:08 -05:00
|
|
|
```bash
|
2022-02-24 21:41:49 +00:00
|
|
|
npm completion
|
2019-11-05 14:55:08 -05:00
|
|
|
```
|
|
|
|
|
2021-03-23 14:58:11 -04:00
|
|
|
Note: This command is unaware of workspaces.
|
|
|
|
|
2019-11-05 14:55:08 -05:00
|
|
|
### Description
|
2011-11-21 09:48:45 -08:00
|
|
|
|
|
|
|
Enables tab-completion in all npm commands.
|
|
|
|
|
|
|
|
The synopsis above
|
|
|
|
loads the completions into your current shell. Adding it to
|
|
|
|
your ~/.bashrc or ~/.zshrc will make the completions available
|
2015-10-09 23:13:57 -07:00
|
|
|
everywhere:
|
|
|
|
|
2019-11-05 14:55:08 -05:00
|
|
|
```bash
|
|
|
|
npm completion >> ~/.bashrc
|
|
|
|
npm completion >> ~/.zshrc
|
|
|
|
```
|
2011-11-21 09:48:45 -08:00
|
|
|
|
2018-11-29 14:05:52 -08:00
|
|
|
You may of course also pipe the output of `npm completion` to a file
|
2020-11-03 20:39:24 -05:00
|
|
|
such as `/usr/local/etc/bash_completion.d/npm` or
|
|
|
|
`/etc/bash_completion.d/npm` if you have a system that will read
|
2018-11-29 14:05:52 -08:00
|
|
|
that file for you.
|
2011-11-21 09:48:45 -08:00
|
|
|
|
|
|
|
When `COMP_CWORD`, `COMP_LINE`, and `COMP_POINT` are defined in the
|
|
|
|
environment, `npm completion` acts in "plumbing mode", and outputs
|
|
|
|
completions based on the arguments.
|
|
|
|
|
2019-11-05 14:55:08 -05:00
|
|
|
### See Also
|
2011-11-21 09:48:45 -08:00
|
|
|
|
2019-11-05 14:55:08 -05:00
|
|
|
* [npm developers](/using-npm/developers)
|
2020-11-01 07:54:36 +01:00
|
|
|
* [npm](/commands/npm)
|