y
y
yq
Search…
Shell Completion
Generate a shell completion file for supported shells (bash/fish/zsh/powershell)
1
yq shell-completion --variation=zsh
Copied!
Prints to StdOut a shell completion script for zsh shell.

Bash (default)

1
source <(yq shell-completion bash)
Copied!

To load completions for each session, execute once:

Linux:
1
yq shell-completion bash > /etc/bash_completion.d/yq
Copied!
MacOS:
1
yq shell-completion bash > /usr/local/etc/bash_completion.d/yq
Copied!

zsh

If shell completion is not already enabled in your environment you will need to enable it. You can execute the following once:
1
echo "autoload -U compinit; compinit" >> ~/.zshrc
Copied!

To load completions for each session, execute once:

1
yq shell-completion zsh > "${fpath[1]}/_yq"
Copied!
You will need to start a new shell for this setup to take effect.

fish

1
yq shell-completion fish | source
Copied!

To load completions for each session, execute once:

1
yq shell-completion fish > ~/.config/fish/completions/yq.fish
Copied!

PowerShell

1
yq shell-completion powershell
Copied!
Users need PowerShell version 5.0 or above, which comes with Windows 10 and can be downloaded separately for Windows 7 or 8.1. They can then write the completions to a file and source this file from their PowerShell profile, which is referenced by the $Profile environment variable.
Last modified 29d ago