跳至内容

PSCompletions and argc-completions

TIP

WARNING

  • 部分补全可能因为编码错误而乱码
  • 可能需要修改输出编码为 UTF-8
powershell
$OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = [System.Text.UTF8Encoding]::new()

使用 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. 安装它

    sh
    scoop install abyss/sigoden.Argc-completions
  3. 将以下内容加入到 $Profile

powershell
# argc-completions
Set-Alias ch chezmoi # 设置 chezmoi 别名
$argc_scripts = @("gh", "chezmoi")
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. 将以下内容加入到 $Profile
powershell
# argc-completions
Set-Alias ch chezmoi # 设置 chezmoi 别名
$env:ARGC_COMPLETIONS_ROOT = 'D:\argc-completions'
$env:PATH = $env:ARGC_COMPLETIONS_ROOT + '\bin' + [IO.Path]::PathSeparator + $env:PATH
$argc_scripts = @("gh", "chezmoi")
argc --argc-completions powershell $argc_scripts | Out-String | Invoke-Expression
$PSCompletions.argc_completions($argc_scripts)