completion
Generate shell completion scripts for NDCLI. Tab completion helps you discover commands, flags, and arguments quickly.
Supported Shells
| Shell | Command |
|---|---|
| Bash | ndcli completion bash |
| Zsh | ndcli completion zsh |
| Fish | ndcli completion fish |
| PowerShell | ndcli completion powershell |
Bash
Generate the autocompletion script for Bash.
ndcli completion bashInstallation
Add to your ~/.bashrc:
source <(ndcli completion bash)Or save to the completions directory:
ndcli completion bash > /etc/bash_completion.d/ndcliNotes
- Requires bash-completion package
- Changes take effect in new shell sessions
- Run
source ~/.bashrcto apply immediately
Zsh
Generate the autocompletion script for Zsh.
ndcli completion zshInstallation
Add to your ~/.zshrc:
source <(ndcli completion zsh)Or save to your completions directory:
ndcli completion zsh > "${fpath[1]}/_ndcli"If Completions Don’t Work
Ensure compinit is initialized. Add to ~/.zshrc before sourcing completions:
autoload -Uz compinit && compinitFish
Generate the autocompletion script for Fish shell.
ndcli completion fishInstallation
Add to your ~/.config/fish/config.fish:
ndcli completion fish | sourceOr save to completions directory:
ndcli completion fish > ~/.config/fish/completions/ndcli.fishPowerShell
Generate the autocompletion script for PowerShell.
ndcli completion powershellInstallation
Add to your PowerShell profile ($PROFILE):
ndcli completion powershell | Out-String | Invoke-ExpressionTo load for every session, add the above line to your profile:
notepad $PROFILECompletion Features
Once installed, tab completion provides:
Command Discovery
ndcli <TAB>Subcommand Discovery
ndcli device <TAB>Flag Discovery
ndcli device list --<TAB>Flag Values
ndcli device list --status <TAB>
ndcli device list --format <TAB>Troubleshooting
Completions Not Working
- Restart your shell - New completion scripts need a fresh shell
- Check if script is loaded - Verify the source command is in your rc file
- Check bash-completion - Ensure bash-completion package is installed
Slow Completions
If completions are slow, they may be fetching data from the API. Consider:
- Checking network connectivity
- Ensuring you’re authenticated (
ndcli auth show)
Updating Completions
Regenerate completions after NDCLI updates:
ndcli completion bash > ~/.local/share/bash-completion/completions/ndcli
ndcli completion zsh > "${fpath[1]}/_ndcli"
ndcli completion fish > ~/.config/fish/completions/ndcli.fish