跳至内容

PSCompletions and argc-completions

TIP

使用 Scoop

  1. 添加 abyss bucket (GithubGitee)

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

    sh
    scoop install abyss/sigoden.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) 

不使用 Scoop

  1. 完成 argc-completions快速开始

请参照最新的 argc-completions 仓库

bash
  git clone https://github.com/sigoden/argc-completions.git
  cd argc-completions
  ./scripts/download-tools.sh
  ./scripts/setup-shell.sh powershell
  1. 最终,argc-completions 需要将以下代码加入到 $Profile 中。

你需要像以下示例代码一样替换掉最后一行。

powershell
# argc-completions
$env:ARGC_COMPLETIONS_ROOT = 'D:\argc-completions'
$env:ARGC_COMPLETIONS_PATH = ($env:ARGC_COMPLETIONS_ROOT + '\completions\windows;' + $env:ARGC_COMPLETIONS_ROOT + '\completions')
$env:PATH = $env:ARGC_COMPLETIONS_ROOT + '\bin' + [IO.Path]::PathSeparator + $env:PATH
# To add completions for only the specified command, modify next line e.g. $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)