PSCompletions and argc-completions
TIP
- argc-completions 是一个命令补全仓库,提供了 1000+ 命令补全
- 通过以下步骤,可以让 PSCompletions 和 argc-completions 一起工作
使用 Scoop
添加 abyss bucket (Github 或 Gitee)
shscoop bucket add abyss https://github.com/abgox/abyss
shscoop bucket add abyss https://gitee.com/abgox/abyss
安装 Argc-completions
shscoop install abyss/sigoden.Argc-completions
将以下代码加入到
$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
- 完成 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
- 最终,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)