npm-completion

npm 的选项卡补全

选择 CLI 版本:

概要

¥Synopsis

npm completion

注意:此命令对工作区无感知。

¥Note: This command is unaware of workspaces.

描述

¥Description

在所有 npm 命令中启用制表符补全。

¥Enables tab-completion in all npm commands.

上面的概要将完成加载到你当前的 shell 中。将其添加到你的 ~/.bashrc 或 ~/.zshrc 将使完成在任何地方都可用:

¥The synopsis above loads the completions into your current shell. Adding it to your ~/.bashrc or ~/.zshrc will make the completions available everywhere:

npm completion >> ~/.bashrc
npm completion >> ~/.zshrc

当然,如果你有一个可以为你读取该文件的系统,你当然也可以将 npm completion 的输出通过管道传输到诸如 /usr/local/etc/bash_completion.d/npm/etc/bash_completion.d/npm 之类的文件中。

¥You may of course also pipe the output of 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.

当环境中定义了 COMP_CWORDCOMP_LINECOMP_POINT 时,npm completion 作用于 "管道模式",并根据参数输出完成。

¥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.

也可以看看

¥See Also

npm 中文网 - 粤ICP备13048890号