Enabling WP-CLI autocompletion

Note

You'll need to modify ~/.bash_profile  to enable WP-CLI autocompletion, and it may crash your shell environment. Before following steps we strongly recommend create snapshot (backup) on  AMIMOTO Dashboard for AMIMOTO Managed Hosting user;  AWS Console or AWS-CLI  for AMIMOTO AMI / Self Hosting user.
Restoring from snapshot, if you're AMIMOTO Managed Hosting user, feel free to ask us on AMIMOTO Dashboard; if you're AMIMTO AMI / Self Hosting user, you can restore it on AWS Console or  AWS-CLI .


Steps

1. Accessing server with SSH

Managed Hosting Customer: please check  Managed Hosting Customer section on our document Connecting your server using SSH | Amimoto Help Center
Self Hosting Customer  please check  Self Hosting Customer section on our document Connecting your server using SSH | Amimoto Help Center
  

2. Download wp-completion.bash 

Download wp-completion.bash on ~/.wp-cli

$ curl -L https://raw.githubusercontent.com/wp-cli/wp-cli/master/utils/wp-completion.bash -o ~/.wp-cli/wp-completion.bash 

3. Load the  script from default shell

Bash is the default shell on  AMIMOTO Managed Hosting AMIMOTO AMI / Self Hosting. If you're using other shell like Fish or Zsh on the instance, please check official or user group's documents on the shell.

Add the following content to  ~/.bash_profile .

source $HOME/.wp-cli/wp-completion.bash

4. Check it will work

Log out from the server and re-login.
After re-login, you can call autocompletion with typing wp and hitting [tab] key.

$ wp
cache      db          menu        role             super-admin
cap        eval        network     scaffold         taxonomy
checksum   eval-file   option      search-replace   term
cli        export      package     server           theme
comment    help        plugin      shell            transient
config     import      post        shifter          user      core       language    post-type   sidebar          cron     media      rewrite     site        widget