Skip to content

completions

The completions command prints a shell completion script for the graphql CLI to stdout. Redirect the output to the location your shell loads completions from.

Terminal window
graphql completions <SHELL>

bash, zsh, fish, powershell, elvish

Terminal window
graphql completions bash > ~/.local/share/bash-completion/completions/graphql

Or system-wide:

Terminal window
graphql completions bash | sudo tee /etc/bash_completion.d/graphql > /dev/null

Make sure the target directory is on your $fpath, then:

Terminal window
graphql completions zsh > ~/.zfunc/_graphql

If you use Oh My Zsh:

Terminal window
graphql completions zsh > ~/.oh-my-zsh/completions/_graphql

You may need to run compinit (or restart your shell) for completions to load.

Terminal window
graphql completions fish > ~/.config/fish/completions/graphql.fish
Terminal window
graphql completions powershell | Out-String | Invoke-Expression

To persist, add the line above to your PowerShell profile ($PROFILE).

Terminal window
graphql completions elvish > ~/.config/elvish/lib/graphql-completions.elv

Then in your rc.elv:

use graphql-completions