Skip to content

PSCompletions and argc-completions

TIP

  1. You need a quick start to argc-completions.

Please refer to the latest argc-completions repo.

bash
  git clone https://github.com/sigoden/argc-completions.git
  cd argc-completions
  ./scripts/download-tools.sh
  ./scripts/setup-shell.sh powershell
  1. At last, argc-completions requires you to add the following code into $PROFILE.

You need to replace the last line as in the following example code.

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 accepts an array of commands.
    • e.g. @("cargo", "git")