Skip to content

PSCompletions and argc-completions

TIP

  1. 添加 abyss (使用 Github 或 Gitee 仓库)

    pwsh
    scoop bucket add abyss https://github.com/abgox/abyss
    pwsh
    scoop bucket add abyss https://gitee.com/abgox/abyss
  2. 安装 Argc-completions

    pwsh
    scoop install abyss/Argc-completions
  3. 将以下代码加入到 $Profile 中。

powershell
# argc-completions
# 要仅为指定的命令添加补全,请修改下一行,例如 $argc_scripts = @(“cargo”, “git”)
$argc_scripts = $env:ARGC_COMPLETIONS_PATH -split [System.IO.Path]::PathSeparator | Get-ChildItem -File | ForEach-Object { $_.BaseName }
argc --argc-completions powershell $argc_scripts | Out-String | Invoke-Expression
$PSCompletions.argc_completions($argc_scripts) 
  • $PSCompletions.argc_completions 接受一个数组,表示要补全的命令列表
    • 如: @("cargo", "git")