stracectl ships a completion subcommand that emits shell completion scripts for bash, zsh, fish and PowerShell. Use the generated script to enable tab completion for your shell.

Generate completion for your current shell:

stracectl completion bash   # bash
stracectl completion zsh    # zsh
stracectl completion fish   # fish
stracectl completion powershell # PowerShell

Install examples

  • Bash (temporary):
source <(stracectl completion bash)
  • Bash (system/user install):
# system-wide (requires root)
sudo stracectl completion bash > /etc/bash_completion.d/stracectl

# per-user
mkdir -p ~/.local/share/bash-completion/completions
stracectl completion bash > ~/.local/share/bash-completion/completions/stracectl
  • Zsh (common):
# write to a directory on your fpath (example: ~/.zfunc)
mkdir -p ~/.zfunc
stracectl completion zsh > ~/.zfunc/_stracectl
fpath=(~/.zfunc $fpath)
autoload -U compinit && compinit
  • Fish:
stracectl completion fish > ~/.config/fish/completions/stracectl.fish
  • PowerShell (Windows / cross-platform PowerShell):
stracectl completion powershell | Out-File -Encoding UTF8 "$HOME\Documents\WindowsPowerShell\profile.ps1"
# or append the output to a profile file used by your PowerShell host

Notes

  • The exact installation path can vary by distribution and shell setup. If in doubt, generate the script and source it temporarily to verify behavior.
  • Autocompletion scripts are generated by Cobra and are safe to inspect before installing.