Skip to main content
Version: 8.x

命令行 tab 补全

与其他通常需要插件的流行包管理器不同,pnpm 支持 Bash、Zsh、Fish 和类似 shell 的命令行制表符补全。

¥Unlike other popular package managers, which usually require plugins, pnpm supports command line tab-completion for Bash, Zsh, Fish, and similar shells.

要设置自动补齐,请运行:

¥To setup autocompletion, run:

pnpm install-completion

CLI 将询问使用哪个 shell 来生成自动补齐脚本。或者,也可以在命令行中指定目标 shell:

¥The CLI will ask for which shell to generate the autocompletion script. Alternatively, the target shell may be specified in the command line:

pnpm install-completion zsh

要查看完成的示例,请阅读 本文

¥To see examples of completion, read this article.

Fig(仅限 macOS)

¥Fig (on macOS only)

你可以使用 为 pnpm 获取 IDE 风格的自动补齐功能。它适用于 Bash、Zsh 和 Fish。

¥You can get IDE-style autocompletions for pnpm with Fig. It works in Bash, Zsh, and Fish.

要安装,请运行:

¥To install, run:

brew install fig

g-plane/pnpm-shell-completion

pnpm-shell-completion 是 Pig Fang 在 Github 上维护的一个 shell 插件。

¥pnpm-shell-completion is a shell plugin maintained by Pig Fang on Github.

特性:

¥Features:

  • 完成 pnpm --filter <package>

    ¥Provide completion for pnpm --filter <package>.

  • 提供 pnpm remove 命令的补全,即使在工作区的包中(通过指定 --filter 选项)。

    ¥Provide completion for pnpm remove command, even in workspace's packages (by specifying --filter option).

  • package.json 中的脚本提供补全。

    ¥Provide completion for scripts in package.json.