跳到主内容
版本:Next

命令行 tab 自动补全

提示

Completion for pnpm v9 is incompatible with completion for older pnpm versions. If you have already installed pnpm completion for a version older than v9, you must uninstall it first to ensure that completion for v9 works properly. You can do this by removing the section of code that contains __tabtab in your dot files.

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 for Bash, run:

pnpm completion bash > ~/completion-for-pnpm.bash
echo 'source ~/completion-for-pnpm.bash' >> ~/.bashrc

要查看补全示例,请阅读 这篇文章

Fig(仅限macOS)

您可以使用 Fig 获得一个 IDE 风格的自动补全。 它适用于 Bash、Zsh 和 Fish。

要安装,请运行:

brew install fig

g-plane/pnpm-shell-completion

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

Features:

  • pnpm --filter <package> 提供补全。
  • pnpm remove 提供补全,即使在工作区的包中(通过指定 --filter 选项)。
  • package.json中的脚本提供补全。