Last updated



The completion command generates the scripts to add autocompletion to your bash or zsh shell. This addition is a handy productivity boost if you regularly use redocly from the command line.


redocly completion

The output is a script for you to copy and paste, and add to the configuration file for your shell. The instructions are in the comments of the output.


See bash shell example

To generate an autocompletion script, run the following command from a bash or zsh prompt:

redocly completion

If run from a bash prompt, the completion command outputs the following autocompletion script:

# yargs command completion script
# Installation: redocly completion >> ~/.bashrc
#    or redocly completion >> ~/.bash_profile on OSX.
    local cur_word args type_list


    # ask yargs to generate completions.
    type_list=$(redocly --get-yargs-completions "${args[@]}")

    COMPREPLY=( $(compgen -W "${type_list}" -- ${cur_word}) )

    # if no match was found, fall back to filename completion
    if [ ${#COMPREPLY[@]} -eq 0 ]; then

    return 0
complete -o default -F _redocly_yargs_completions redocly

The installation instructions are included in the output as comments, showing how to run the command and add it to the correct file:

  • redocly completion >> ~/.bashrc
  • Or on OSX: redocly completion >> ~/.bash_profile

If you use zsh shell, the completion command provides a similar output that is appropriate for your system.