WP-CLI インストール

Nid: 1172

コマンドラインツール WP-CLI をインストール

$ cd /tmp
$ curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
$ sudo chown root.root wp-cli.phar
$ sudo chmod +x wp-cli.phar
$ sudo mv wp-cli.phar /usr/local/bin/wp
$ wp --info
OS:     Linux 4.15.0-42-generic #45-Ubuntu SMP Thu Nov 15 19:32:57 UTC 2018 x86_64
Shell:  /bin/bash
PHP binary:     /usr/bin/php7.2
PHP version:    7.2.10-0ubuntu0.18.04.1
php.ini used:   /etc/php/7.2/cli/php.ini
WP-CLI root dir:        phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir:      phar://wp-cli.phar/vendor
WP_CLI phar path:       /tmp
WP-CLI packages dir:
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 2.0.1

更新方法

$ sudo wp cli update
Success: WP-CLI is at the latest version.

bash completion

$ wget -P ~/dotfiles https://github.com/wp-cli/wp-cli/raw/master/utils/wp-completion.bash
$ vi ~/.profile
if [ -f "$HOME/dotfiles/wp-completion.bash" ]; then
    . "$HOME/dotfiles/wp-completion.bash"
fi
$ source ~/.profile