本页内容

deno 命令行补全

将输出 shell 完成脚本到标准输出。

命令 跳转到标题

deno completions [OPTIONS] <SHELL> - 为指定的 shell 生成完成脚本。

概要 跳转到标题

deno completions [-q|--quiet] <SHELL>

deno completions -h|--help

描述 跳转到标题

completions 命令生成一个脚本,用于配置 Deno 的 shell 完成。执行该脚本将配置 shell 以提供对 Deno 命令和子命令的完成。

参数 跳转到标题

SHELL

可能的值:bash、fish、powershell、zsh、fig

选项 跳转到标题

  • -q, --quiet

    抑制诊断输出

  • -h, --help

    打印帮助(使用 '-h' 查看摘要)

示例 跳转到标题

  • 配置 Bash shell 完成
deno completions bash > /usr/local/etc/bash_completion.d/deno.bash
source /usr/local/etc/bash_completion.d/deno.bash
  • 配置 PowerShell shell 完成
deno completions powershell | Out-String | Invoke-Expression
  • 配置 zsh shell 完成

首先将以下内容添加到您的 .zshrc 文件中

fpath=(~/.zsh/completion $fpath)
autoload -U compinit
compinit

然后运行以下命令

deno completions zsh > _deno
mv _deno ~/.zsh/completion/_deno
autoload -U compinit && compinit
  • 配置 fish shell 完成
deno completions fish > completions.fish
chmod +x ./completions.fish