wp cli

Текущая информация о WP-CLI, обновления, просмотр псевдонимов.

Список команд Описание
wp cli version Выводит версию WP-CLI.
wp cli info Вывод различных сведений о среде WP-CLI.
wp cli check-update Проверяет, доступна ли более новая версия WP-CLI.
wp cli update Обновляет WP-CLI до последней версии.
wp cli param-dump Выводит список глобальных параметров в формате JSON или var_export.
wp cli cmd-dump Выводит список установленных команд в формате JSON.
wp cli completions Создает строки завершения табуляции.
wp cli alias Список доступных псевдонимов WP-CLI.
wp cli has-command Определяет, существует ли команда.

Примеры

# Display the version currently installed.
$ wp cli version
WP-CLI 0.24.1

# Check for updates to WP-CLI.
$ wp cli check-update
Success: WP-CLI is at the latest version.

# Update WP-CLI to the latest stable release.
$ wp cli update
You have version 0.24.0. Would you like to update to 0.24.1? [y/n] y
Downloading from https://github.com/wp-cli/wp-cli/releases/download/v0.24.1/wp-cli-0.24.1.phar...
New version works. Proceeding to replace.
Success: Updated WP-CLI to 0.24.1.

Исходный код команд


wp cli version

Выводит версию WP-CLI.

Использование

wp cli version 

Примеры

# Display CLI version.
$ wp cli version
WP-CLI 0.24.1

wp cli info

Вывод различных сведений о среде WP-CLI.

Helpful for diagnostic purposes, this command shares:

  • OS information.
  • Shell information.
  • PHP binary used.
  • PHP binary version.
  • php.ini configuration file used (which is typically different than web).
  • WP-CLI root dir: where WP-CLI is installed (if non-Phar install).
  • WP-CLI global config: where the global config YAML file is located.
  • WP-CLI project config: where the project config YAML file is located.
  • WP-CLI version: currently installed version.

See config docs for more details on global and project config YAML files.

Использование

wp cli info [--format={format}]

Можно указать Глобальные параметры и следующие:

[--format={format}]

Render output in a particular format.
По умолчанию: list
Может быть:

  • list
  • json

Примеры

# Display various data about the CLI environment.
$ wp cli info
	OS:  Linux 4.10.0-42-generic #46~16.04.1-Ubuntu SMP Mon Dec 4 15:57:59 UTC 2017 x86_64
	Shell:   /usr/bin/zsh
	PHP binary:  /usr/bin/php
	PHP version: 7.1.12-1+ubuntu16.04.1+deb.sury.org+1
	php.ini used:    /etc/php/7.1/cli/php.ini
	WP-CLI root dir:    phar://wp-cli.phar
	WP-CLI packages dir:    /home/person/.wp-cli/packages/
	WP-CLI global config:
	WP-CLI project config:
	WP-CLI version: 1.5.0

wp cli check-update

Проверяет, доступна ли более новая версия WP-CLI.

Queries the Github releases API. Returns available versions if there are updates available, or success message if using the latest release.

Использование

wp cli check-update [--patch] [--minor] [--major] [--field={field}] [--fields={fields}] [--format={format}]

Можно указать Глобальные параметры и следующие:

[--patch]
Only list patch updates.
[--minor]
Only list minor updates.
[--major]
Only list major updates.
[--field={field}]
Prints the value of a single field for each update.
[--fields={fields}]
Limit the output to specific object fields. Defaults to version,update_type,package_url.
[--format={format}]

Render output in a particular format.
По умолчанию: table
Может быть:

  • table
  • csv
  • json
  • count
  • yaml

Примеры

# Check for update.
$ wp cli check-update
Success: WP-CLI is at the latest version.
# Check for update and new version is available.
$ wp cli check-update
+---------+-------------+-------------------------------------------------------------------------------+
| version | update_type | package_url                                                                   |
+---------+-------------+-------------------------------------------------------------------------------+
| 0.24.1  | patch       | https://github.com/wp-cli/wp-cli/releases/download/v0.24.1/wp-cli-0.24.1.phar |
+---------+-------------+-------------------------------------------------------------------------------+

wp cli update

Обновляет WP-CLI до последней версии.

Default behavior is to check the releases API for the newest stable version, and prompt if one is available.

Use --stable to install or reinstall the latest stable version.

Use --nightly to install the latest built version of the master branch. While not recommended for production, nightly contains the latest and greatest, and should be stable enough for development and staging environments.

Only works for the Phar installation mechanism.

Использование

wp cli update [--patch] [--minor] [--major] [--stable] [--nightly] [--yes]

Можно указать Глобальные параметры и следующие:

[--patch]
Only perform patch updates.
[--minor]
Only perform minor updates.
[--major]
Only perform major updates.
[--stable]
Update to the latest stable release. Skips update check.
[--nightly]
Update to the latest built version of the master branch. Potentially unstable.
[--yes]
Do not prompt for confirmation.

Примеры

# Update CLI.
$ wp cli update
You have version 0.24.0. Would you like to update to 0.24.1? [y/n] y
Downloading from https://github.com/wp-cli/wp-cli/releases/download/v0.24.1/wp-cli-0.24.1.phar...
New version works. Proceeding to replace.
Success: Updated WP-CLI to 0.24.1.

wp cli param-dump

Выводит список глобальных параметров в формате JSON или var_export.

Использование

wp cli param-dump [--with-values] [--format={format}]

Можно указать Глобальные параметры и следующие:

[--with-values]
Display current values also.
[--format={format}]

Render output in a particular format.
По умолчанию: json
Может быть:

  • var_export
  • json

Примеры

# Dump the list of global parameters.
$ wp cli param-dump --format=var_export
array (
  'path' =>
  array (
	'runtime' => '=<path>',
	'file' => '<path>',
	'synopsis' => '',
	'default' => NULL,
	'multiple' => false,
	'desc' => 'Path to the WordPress files.',
  ),
  'url' =>
  array (

wp cli cmd-dump

Выводит список установленных команд в формате JSON.

Использование

wp cli cmd-dump 

Примеры

# Dump the list of installed commands.
$ wp cli cmd-dump
{"name":"wp","description":"Manage WordPress through the command-line.","longdesc":"\n\n## GLOBAL PARAMETERS\n\n  --path=<path>\n      Path to the WordPress files.\n\n  --ssh=<ssh>\n      Perform operation against a remote server over SSH (or a container using scheme of "docker" or "docker-compose").\n\n  --url=<url>\n      Pretend request came from given URL. In multisite, this argument is how the target site is specified. \n\n  --user=<id|login|email>\n

wp cli completions

Создает строки завершения табуляции.

Использование

wp cli completions --line={line} --point={point}

Можно указать Глобальные параметры и следующие:

--line={line}
The current command line to be executed.
--point={point}
The index to the current cursor position relative to the beginning of the command.

Примеры

# Generate tab completion strings.
$ wp cli completions --line='wp eva' --point=100
eval
eval-file

wp cli alias

Список доступных псевдонимов WP-CLI.

Aliases are shorthand references to WordPress installs. For instance, @dev could refer to a development installation and @prod could refer to a production installation. This command gives you visibility in what registered aliases you have available.

Использование

wp cli alias [--format={format}]

Можно указать Глобальные параметры и следующие:

[--format={format}]

Render output in a particular format.
По умолчанию: yaml
Может быть:

  • yaml
  • json
  • var_export

Примеры

# List all available aliases.
$ wp cli alias
---
@all: Run command against every registered alias.
@prod:
  ssh: runcommand@runcommand.io~/webapps/production
@dev:
  ssh: vagrant@192.168.50.10/srv/www/runcommand.dev
@both:
  - @prod
  - @dev

wp cli has-command

Определяет, существует ли команда.

This commands checks if a command is registered with WP-CLI. If the command is found then it returns with exit status 0. If the command doesn't exist, then it will exit with status 1.

Использование

wp cli has-command {command_name}...

Можно указать Глобальные параметры и следующие:

{command_name}...
The command

Примеры

# The "site delete" command is registered.
$ wp cli has-command "site delete"
$ echo $?
0
# The "foo bar" command is not registered.
$ wp cli has-command "foo bar"
$ echo $?
1