Shell Completion
Radium CLI supports tab completion for bash, zsh, and fish shells.
Generating Completionsβ
Using the Generation Scriptβ
# Generate all completion scripts
./scripts/generate-completions.sh
This will create completion files in the completions/ directory:
completions/rad.bash- Bash completioncompletions/rad.zsh- Zsh completioncompletions/rad.fish- Fish completion
Manual Generationβ
You can also generate completions manually using the CLI:
# Set environment variable and run CLI
RADIUM_GENERATE_COMPLETIONS=bash cargo run --release -p radium-cli > completions/rad.bash
RADIUM_GENERATE_COMPLETIONS=zsh cargo run --release -p radium-cli > completions/rad.zsh
RADIUM_GENERATE_COMPLETIONS=fish cargo run --release -p radium-cli > completions/rad.fish
RADIUM_GENERATE_COMPLETIONS=powershell cargo run --release -p radium-cli > completions/rad.ps1
RADIUM_GENERATE_COMPLETIONS=elvish cargo run --release -p radium-cli > completions/rad.elv
Or if you have the rad binary installed:
RADIUM_GENERATE_COMPLETIONS=bash rad > completions/rad.bash
RADIUM_GENERATE_COMPLETIONS=zsh rad > completions/rad.zsh
RADIUM_GENERATE_COMPLETIONS=fish rad > completions/rad.fish
RADIUM_GENERATE_COMPLETIONS=powershell rad > completions/rad.ps1
RADIUM_GENERATE_COMPLETIONS=elvish rad > completions/rad.elv
Installationβ
Bashβ
Add to your ~/.bashrc or ~/.bash_profile:
source /path/to/radium/completions/rad.bash
Or for system-wide installation:
sudo cp completions/rad.bash /etc/bash_completion.d/rad
Zshβ
Add to your ~/.zshrc:
source /path/to/radium/completions/rad.zsh
Or use the zsh completions directory:
mkdir -p ~/.zsh/completions
cp completions/rad.zsh ~/.zsh/completions/_rad
Then add to ~/.zshrc:
fpath=(~/.zsh/completions $fpath)
autoload -U compinit
compinit
Fishβ
Copy to fish completions directory:
mkdir -p ~/.config/fish/completions
cp completions/rad.fish ~/.config/fish/completions/rad.fish
Or create a symlink:
ln -s /path/to/radium/completions/rad.fish ~/.config/fish/completions/rad.fish
Usageβ
After installation, tab completion will work automatically:
# Complete commands
rad <TAB>
# Shows: init, plan, craft, complete, step, run, chat, ...
# Complete subcommands
rad agents <TAB>
# Shows: list, search, info, validate, create
# Complete options
rad craft --<TAB>
# Shows: --iteration, --task, --resume, --dry-run, --json, --yolo, --engine
Supported Shellsβ
The CLI supports completion generation for all major shells:
- Bash - Full support for commands, subcommands, and options
- Zsh - Full support with enhanced completion features
- Fish - Full support with fish-specific enhancements
- PowerShell - Full support (Windows)
- Elvish - Full support
All 30+ commands and their subcommands are included in the completions. The completion system uses clap_complete to automatically generate completions from the command structure defined in main.rs.
Troubleshootingβ
Completions not workingβ
-
Reload shell configuration:
# Bash
source ~/.bashrc
# Zsh
source ~/.zshrc
# Fish
# Restart fish shell -
Check file permissions:
chmod +x completions/rad.bash -
Verify installation path:
# Check if file exists
ls -la ~/.config/fish/completions/rad.fish
Regenerating completionsβ
If you add new commands or options, regenerate completions:
./scripts/generate-completions.sh
Then reload your shell configuration.