completion
rfswift completion
Generate and install shell completion scripts for tab-completion.
Synopsis
# Auto-detect shell and install
rfswift completion
# Install for specific shell
rfswift completion bash
rfswift completion zsh
rfswift completion fish
rfswift completion powershellThe completion command generates and installs tab-completion scripts for your shell, enabling command, flag, and argument completion when you press Tab.
Examples
Basic Usage
Auto-detect and install:
rfswift completion
# Detected shell: bash
# Installing completion script to /etc/bash_completion.d/rfswift
# ✓ Completion script installed successfullyInstall for specific shell:
# Bash
rfswift completion bash
# Zsh
rfswift completion zsh
# Fish
rfswift completion fish
# PowerShell
rfswift completion powershellInstallation Locations
Bash
System-wide (requires sudo):
/etc/bash_completion.d/rfswiftUser-specific:
~/.bash_completion.d/rfswift
~/.bash_completionEnable in ~/.bashrc:
# Add if not already present
[[ -f ~/.bash_completion ]] && source ~/.bash_completionZsh
Common locations:
~/.zsh/completion/_rfswift
~/.oh-my-zsh/completions/_rfswift
/usr/local/share/zsh/site-functions/_rfswift
${fpath[1]}/_rfswiftEnable in ~/.zshrc:
# Add completion directory to fpath
fpath=(~/.zsh/completion $fpath)
# Initialize completion system
autoload -Uz compinit
compinitFish
Location:
~/.config/fish/completions/rfswift.fishNo additional configuration needed - Fish loads completions automatically.
PowerShell
Profile location:
# Check profile path
echo $PROFILE
# Typical locations:
# Windows PowerShell:
# ~\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
# PowerShell Core:
# ~\Documents\PowerShell\Microsoft.PowerShell_profile.ps1Enable in profile:
# Add to profile
. "C:\Path\To\CompletionScripts\rfswift.ps1"How Completion Works
What Gets Completed
Commands:
rfswift <Tab>
# Shows: run, exec, stop, remove, images, last, etc.Subcommands:
rfswift images <Tab>
# Shows: local, remote, pullFlags:
rfswift run -<Tab>
# Shows: -i, -n, -b, -p, -d, etc.Container names:
rfswift exec -c <Tab>
# Shows: container1, container2, container3, etc.Image names:
rfswift run -i <Tab>
# Shows: penthertz/rfswift_noble:sdr_full, penthertz/rfswift_noble:wifi, etc.Completion Features
Smart completion:
- Only shows relevant options for current context
- Completes container names from running containers
- Completes image names from local images
- Suggests common values for flags
Troubleshooting
Completion Not Working
Problem: Tab completion doesn’t work
Solutions:
For Bash:
# Check if completion file exists
ls -la ~/.bash_completion.d/rfswift
ls -la ~/.bash_completion
# Check if sourced in .bashrc
grep bash_completion ~/.bashrc
# Add if missing
echo '[[ -f ~/.bash_completion ]] && source ~/.bash_completion' >> ~/.bashrc
# Reload
source ~/.bashrcFor Zsh:
# Check if completion file exists
ls -la ~/.zsh/completion/_rfswift
# Check fpath
echo $fpath
# Add completion directory to .zshrc
cat >> ~/.zshrc << 'EOF'
fpath=(~/.zsh/completion $fpath)
autoload -Uz compinit
compinit
EOF
# Reload
source ~/.zshrcFor Fish:
# Check if completion file exists
ls -la ~/.config/fish/completions/rfswift.fish
# Reload completions
fish_update_completions
# Restart fish
exec fishPermission Denied
Problem: Cannot write completion file
Solutions:
# Check permissions
ls -ld /etc/bash_completion.d
# Install to user directory instead
rfswift completion bash
# Will install to ~/.bash_completion.d/
# Or use sudo for system-wide
sudo rfswift completion bashOld Completions Cached
Problem: Completions show old commands
Solutions:
Bash:
# Clear completion cache
complete -r rfswift
# Reinstall
rfswift completion bash
# Reload
source ~/.bashrcZsh:
# Remove compiled completion files
rm -f ~/.zcompdump*
# Reinstall
rfswift completion zsh
# Rebuild cache
autoload -Uz compinit
compinit
# Reload
source ~/.zshrcFish:
# Clear fish cache
rm -rf ~/.cache/fish/
# Reinstall
rfswift completion fish
# Restart
exec fishCompletions Conflict
Problem: Completions conflict with other tools
Solutions:
# Check what provides rfswift completion
complete -p rfswift # Bash
which -a rfswift # Check multiple installations
# Remove conflicting completion
rm /path/to/conflicting/completion
# Reinstall correct one
rfswift completionShell Not Detected
Problem: Auto-detection fails
Solutions:
# Specify shell explicitly
rfswift completion bash
# Or set SHELL variable
export SHELL=/bin/bash
rfswift completionRelated Commands
source ~/.bashrc or restart terminal) before tab-completion will work.rfswift completion without arguments automatically detects your shell and installs the appropriate completion script. You can also specify the shell explicitly!