PSCompletions
and argc-completions
TIP
- argc-completions 是一个命令补全仓库,提供了 1000+ 命令补全
- 通过以下步骤,可以让 PSCompletions 和 argc-completions 一起工作
- 完成 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
# Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete
$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 = ((Get-ChildItem -File -Path ($env:ARGC_COMPLETIONS_ROOT + '\completions\windows'), ($env:ARGC_COMPLETIONS_ROOT + '\completions')) | ForEach-Object { $_.BaseName })
argc --argc-completions powershell $argc_scripts | Out-String | Invoke-Expression
$PSCompletions.argc_completions($argc_scripts)
$PSCompletions.argc_completions
接受一个数组,表示要补全的命令列表- 如:
@("cargo", "git")
- 如: