Skip to content

Commit 098288a

Browse files
Merge pull request wp-cli#207 from wp-cli/env-variables
Add section on environment variables to config page
2 parents 63dfa06 + d80e9a3 commit 098288a

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

config/index.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ title: Configuration
55

66
# Configuration
77

8-
<p><small>Quick links: <a href="#overview">Overview</a> | <a href="#global-parameters">Global parameters</a> | <a href="#config-files">Config files</a></small></p>
8+
<p><small>Quick links: <a href="#overview">Overview</a> | <a href="#global-parameters">Global parameters</a> | <a href="#config-files">Config files</a></small> | <a href="#environment-variables">Environment variables</a></small></p>
99

1010
## Overview
1111

@@ -93,3 +93,23 @@ Here's an annotated example `wp-cli.yml` file:
9393
ssh: wpcli@wp-cli.org:2222
9494
user: wpcli
9595
path: /srv/www/wp-cli.org
96+
97+
## Environment variables
98+
99+
WP-CLI's behavior can be changed at runtime through the use of environment variables:
100+
101+
* `WP_CLI_CACHE_DIR` - Directory to store the WP-CLI file cache. Default is `~/.wp-cli/cache/`.
102+
* `WP_CLI_CONFIG_PATH` - Path to the global `config.yml` file. Default is `~/.wp-cli/config.yml`.
103+
* `WP_CLI_DISABLE_AUTO_CHECK_UPDATE` - Disable WP-CLI automatic checks for updates.
104+
* `WP_CLI_PACKAGES_DIR` - Directory to store packages installed through WP-CLI's package management. Default is `~/.wp-cli/packages/`.
105+
* `WP_CLI_SSH_PRE_CMD` - When using `--ssh=<ssh>`, perform a command before WP-CLI calls WP-CLI on the remote server.
106+
107+
To set an environment variable on demand, simply place the environment variable definition before the WP-CLI command you mean to run.
108+
109+
# Use vim to edit a post
110+
$ EDITOR=vim wp post edit 1
111+
112+
To set the same environment variable value for every shell session, you’ll need to include the environment variable definition in your `~/.bashrc` or `~/.zshrc` file
113+
114+
# Always use vim to edit a post
115+
export EDITOR=vim

0 commit comments

Comments
 (0)