yq
v4.x
v4.x
  • yq
  • How It Works
  • Recipes
  • Upgrading from V3
  • Commands
    • Evaluate
    • Evaluate All
    • Shell Completion
  • Operators
    • Add
    • Alternative (Default value)
    • Anchor and Alias Operators
    • Array to Map
    • Assign (Update)
    • Boolean Operators
    • Collect into Array
    • Column
    • Comment Operators
    • Compare Operators
    • Contains
    • Create, Collect into Object
    • Date Time
    • Delete
    • Divide
    • Document Index
    • Encode / Decode
    • Entries
    • Env Variable Operators
    • Equals
    • Eval
    • File Operators
    • Filter Operator
    • Flatten
    • Group By
    • Has
    • Keys
    • Kind
    • Length
    • Line
    • Load
    • Min
    • Map
    • Max
    • Modulo
    • Multiply (Merge)
    • Omit
    • Parent
    • Path
    • Pick
    • Pipe
    • Pivot
    • Recursive Descent (Glob)
    • Reduce
    • Reverse
    • Select
    • Shuffle
    • Slice Array
    • Sort
    • Sort Keys
    • Split into Documents
    • String Operators
    • Style
    • Subtract
    • Tag
    • To Number
    • Traverse (Read)
    • Union
    • Unique
    • Variable Operators
    • With
  • Usage
    • Output format
    • Working with CSV, TSV
    • Working with JSON
    • Working with Properties
    • Working with XML
    • Working with LUA
    • Working with TOML
    • Working with Shell Output
    • Front Matter
    • Split into multiple files
    • GitHub Action
    • Tips, Tricks, Troubleshooting
  • Github Page
Powered by GitBook
On this page
  • Bash (default)
  • zsh
  • fish
  • PowerShell

Was this helpful?

  1. Commands

Shell Completion

Generate a shell completion file for supported shells (bash/fish/zsh/powershell)

yq shell-completion zsh

Prints to StdOut a shell completion script for zsh shell.

Bash (default)

source <(yq shell-completion bash)

To load completions for each session, execute once:

Linux:

yq shell-completion bash > /etc/bash_completion.d/yq 

MacOS:

yq shell-completion bash > /usr/local/etc/bash_completion.d/yq

zsh

If shell completion is not already enabled in your environment you will need to enable it. You can execute the following once:

echo "autoload -U compinit; compinit" >> ~/.zshrc

To load completions for each session, execute once:

yq shell-completion zsh > "${fpath[1]}/_yq"

You will need to start a new shell for this setup to take effect.

fish

yq shell-completion fish | source

To load completions for each session, execute once:

yq shell-completion fish > ~/.config/fish/completions/yq.fish

PowerShell

yq shell-completion powershell

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.

PreviousEvaluate AllNextOperators

Last updated 1 year ago

Was this helpful?