首先,找到WP-CLI的安装位置。
如果使用Composer,可以在命令行中列出所有全局安装的软件包,如下所示:
composer global show
然后更新WP-CLI composer包:
composer global update wp-cli/wp-cli
如果您使用的是自制软件,可以在命令行中列出所有已安装的软件包,如下所示:
brew list
并更新包:
brew upgrade wp-cli
此后,您应该能够通过内置命令升级到WP-CLI的下一个版本:
wp cli update
作为回报,您将得到如下提示:
You have version 1.4.1. Would you like to update to 1.5.0? [y/n]
Downloading from https://github.com/wp-cli/wp-cli/releases/download/v1.5.0...
New version works. Proceeding to replace.
Success: Updated WP-CLI to 1.5.0.