Skip to content

completion

The completion command generates shell completion scripts for bash, zsh, and fish shells.

Terminal window
nextdns-blocker completion SHELL

Where SHELL is one of: bash, zsh, or fish.

ShellCommand
Bashnextdns-blocker completion bash
Zshnextdns-blocker completion zsh
Fishnextdns-blocker completion fish

Add to your ~/.bashrc:

Terminal window
eval "$(nextdns-blocker completion bash)"

Then reload:

Terminal window
source ~/.bashrc

Add to your ~/.zshrc:

Terminal window
eval "$(nextdns-blocker completion zsh)"

Then reload:

Terminal window
source ~/.zshrc

Save to the completions directory:

Terminal window
nextdns-blocker completion fish > ~/.config/fish/completions/nextdns-blocker.fish

The completions will be available in new Fish sessions.

Shell completion works for:

  • Commands: nextdns-blocker <TAB> shows all available commands
  • Subcommands: nextdns-blocker config <TAB> shows config subcommands
  • Options: nextdns-blocker config push --<TAB> shows available flags
  • Domains: nextdns-blocker unblock <TAB> shows domains from your blocklist
  • Allowlist: nextdns-blocker disallow <TAB> shows domains from your allowlist
Terminal window
$ nextdns-blocker <TAB>
allow completion fix nextdns pending status update
category config health panic stats test-notifications watchdog
disallow init
Terminal window
$ nextdns-blocker config <TAB>
edit set show push validate
Terminal window
$ nextdns-blocker config push --<TAB>
--config-dir --dry-run --help --verbose
Terminal window
$ nextdns-blocker unblock <TAB>
facebook.com instagram.com reddit.com twitter.com

The fix command can automatically install completions:

Terminal window
nextdns-blocker fix

This will detect your shell and install completions if not already present.

  1. Ensure the eval line is in your shell config file
  2. Open a new terminal or source the config file
  3. Verify the completion is loaded:
    Terminal window
    type _nextdns-blocker # For bash/zsh

Ensure nextdns-blocker is in your PATH:

Terminal window
which nextdns-blocker

If not found, you may need to add the installation directory to your PATH.

Domain completion queries your config file. If you have many domains, there may be a slight delay. This is normal.