Shell Completion
Enable comprehensive tab completion for all xcsh commands, including domain names, operations, resource types, namespaces, and resource names.
Features
Section titled “Features”- Domain Completion: Complete all domain names (e.g.,
virtual,dns,waf) - Operation Completion: Complete all operations (
list,get,create,delete,status,patch,add-labels,remove-labels) - Resource Type Completion: Complete resource types within each domain
- Namespace Completion: Dynamic completion of available namespaces from your API
- Resource Name Completion: Dynamic completion of resource names for
get,delete, andstatusoperations - Label Key Completion: Common label key suggestions for
add-labelsandremove-labelsoperations - Performance: 3-second timeout with 5-minute caching to prevent shell slowdown
# Current sessionsource <(xcsh completion bash)
# Permanent (Linux)xcsh completion bash > /etc/bash_completion.d/xcsh
# Permanent (macOS with Homebrew)xcsh completion bash > $(brew --prefix)/etc/bash_completion.d/xcsh# Enable completion system (if not already enabled)echo "autoload -U compinit; compinit" >> ~/.zshrc
# Install completionxcsh completion zsh > "${fpath[1]}/_xcsh"xcsh completion fish > ~/.config/fish/completions/xcsh.fishPowerShell
Section titled “PowerShell”xcsh completion powershell | Out-String | Invoke-ExpressionUsage Examples
Section titled “Usage Examples”Once completion is installed, use <TAB> to complete commands:
Domain Completion
Section titled “Domain Completion”# Complete domain namesxcsh v<TAB> # Completes to: virtual, vpm_and_node_managementxcsh vi<TAB> # Completes to: virtualxcsh dn<TAB> # Completes to: dnsxcsh wa<TAB> # Completes to: wafOperation Completion
Section titled “Operation Completion”# Complete operationsxcsh virtual <TAB># Suggests: list, get, create, delete, replace, apply, status, patch, add-labels, remove-labels
xcsh dns <TAB># Shows available operationsResource Type Completion
Section titled “Resource Type Completion”# Complete resource typesxcsh virtual list <TAB># Completes to: http_loadbalancer, origin_pool, tcp_loadbalancer, udp_loadbalancer, etc.
xcsh dns get <TAB># Shows dns resource types like dns_zone, dns_domainNamespace Completion
Section titled “Namespace Completion”# Complete namespaces (requires API access)xcsh virtual list http_loadbalancer -ns <TAB># Suggests: default, production, staging, etc. (from your tenant)
xcsh virtual get origin_pool example-pool -ns <TAB># Dynamic namespace completion for your specific namespaceResource Name Completion
Section titled “Resource Name Completion”# Complete resource names (requires API access)xcsh virtual get http_loadbalancer <TAB># Suggests: example-lb-1, prod-lb, staging-lb, etc. (from your namespace)
xcsh virtual delete origin_pool <TAB># Shows available origin pools to deleteLabel Key Completion
Section titled “Label Key Completion”# Complete label keysxcsh virtual add-labels http_loadbalancer example-lb --label-key <TAB># Suggests: environment, application, owner, cost-center, tier, version
xcsh virtual add-labels http_loadbalancer example-lb -ns production --label-key <TAB># Common label keysAPI Integration
Section titled “API Integration”Dynamic completions (namespaces and resource names) require API access:
# Set your API credentialsexport F5XC_API_URL="https://your-tenant.console.ves.volterra.io"export F5XC_API_TOKEN="your-api-token"
# Now namespace and resource name completion will workxcsh virtual list http_loadbalancer -ns <TAB> # Shows your namespacesxcsh virtual get http_loadbalancer <TAB> # Shows your resourcesTroubleshooting
Section titled “Troubleshooting”Completions not working after upgrade
Section titled “Completions not working after upgrade”Zsh caches completion functions in ~/.zcompdump* files. After upgrading xcsh, the stale cache may prevent new completions from loading.
Fix: Clear the cache and restart your shell:
rm -f ~/.zcompdump* && exec zshCompletions not loading at all
Section titled “Completions not loading at all”Ensure the completion system is enabled in your ~/.zshrc:
autoload -Uz compinit && compinitThen restart your shell or run:
source ~/.zshrcDynamic Completions Not Working
Section titled “Dynamic Completions Not Working”If namespace and resource name completions aren’t appearing:
Check API Credentials:
# Verify your API credentials are setecho $F5XC_API_URLecho $F5XC_API_TOKEN
# If not set, configure themexport F5XC_API_URL="https://your-tenant.console.ves.volterra.io"export F5XC_API_TOKEN="your-api-token"Check API Connectivity:
# Test API accesscurl -s -H "Authorization: APIToken $F5XC_API_TOKEN" "$F5XC_API_URL/api/web/namespaces" | head
# If this fails, check your credentials and API URLCompletion Fallback:
If API access fails, completions gracefully fall back to common defaults:
- Namespaces:
default,system - Resource names: None (no fallback available without API)
- Other completions: Static completions work normally
This ensures your shell stays responsive even if the API is unavailable.
Performance Issues
Section titled “Performance Issues”Completions use caching with a 5-minute TTL to prevent performance issues:
Cache Details:
- Static completions (domains, operations, resource types): Instant
- Dynamic completions (namespaces, resource names): 3-second timeout, 5-minute cache
- Cache is per-shell session (new terminal = fresh cache)
If completions are slow:
- Verify your API URL and token are correct
- Check your network connectivity to the API
- The 3-second timeout prevents blocking; if you see delays, it’s usually the API responding slowly