Skip to main content

SET UP SHELL COMPLETIONS

Bash

Generate the completion script and save it to your completions directory:

swamp completions bash > ~/.local/share/bash-completion/completions/swamp

If your distribution uses a different path (e.g., /etc/bash_completion.d/), adjust accordingly.

Zsh

Generate the completion script and save it to a directory in your $fpath:

swamp completions zsh > ~/.zfunc/_swamp

If ~/.zfunc is not already in your fpath, add this to your ~/.zshrc before compinit:

fpath=(~/.zfunc $fpath)
autoload -Uz compinit && compinit

Fish

Generate the completion script and save it to the fish completions directory:

swamp completions fish > ~/.config/fish/completions/swamp.fish

PowerShell

These steps are for PowerShell 7 (pwsh). Windows PowerShell 5.1 is not supported.

Create your PowerShell profile if it doesn't exist yet, then add the line that loads the completion script to it. Run these once — running Add-Content again adds a second copy of the line:

if (-not (Test-Path $PROFILE)) { New-Item -Path $PROFILE -ItemType File -Force }
Add-Content $PROFILE 'swamp completions powershell | Out-String | Invoke-Expression'

Behavior and workflow names complete from the Swamp repository in the current directory, as in the other shells.

On Windows, if PowerShell reports at startup that running scripts is disabled, allow local scripts for your account:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Reload your shell

After saving the completion script, open a new shell session or reload the current one:

# bash
source ~/.bashrc

# zsh
source ~/.zshrc

# fish (completions are loaded automatically)
# PowerShell
. $PROFILE

Type swamp and press Tab to verify completions are working.