Enabling shell autocompletion for IBM Cloud CLI (Linux and macOS only)

Starting from version 0.7.0, the IBM Cloud® Command Line Interface installers don't enable shell autocompletion automatically. To have the autocompletion support, you need to manually enable it. The autocompletion scripts are installed in the following locations:

  • Bash autocompletion: /usr/local/ibmcloud/autocomplete/bash_autocomplete
  • Zsh autocompletion: /usr/local/ibmcloud/autocomplete/zsh_autocomplete

Enabling autocompletion for Linux

  • If you're using Bash, add:

    [[ -f /usr/local/ibmcloud/autocomplete/bash_autocomplete ]] && source /usr/local/ibmcloud/autocomplete/bash_autocomplete into one of the following files:

  • For Login shell: ~/.bash_profile

  • For Nonlogin shell: ~/.bashrc

  • If you're using Zsh: add:

    source /usr/local/ibmcloud/autocomplete/zsh_autocomplete into ~/.zshrc.

Enabling autocompletion support for macOS

  • If you're using Bash, add:

    source /usr/local/ibmcloud/autocomplete/bash_autocomplete into ~/.bash_profile.

  • If you're using Zsh, add:

    source /usr/local/ibmcloud/autocomplete/zsh_autocomplete into ~/.zshrc.