Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document default login credentials and wp-env run command #20678

Merged
merged 8 commits into from
Mar 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion packages/env/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Then, start the local environment:
$ wp-env start
```

Finally, navigate to http://localhost:8888 in your web browser to see WordPress running with the local WordPress plugin or theme running and activated.
Finally, navigate to http://localhost:8888 in your web browser to see WordPress running with the local WordPress plugin or theme running and activated. Default login credentials are username: `admin` password: `password`.

### Stopping the environment

Expand Down Expand Up @@ -175,6 +175,32 @@ Positionals:
[string] [choices: "all", "development", "tests"] [default: "tests"]
```

### `wp-env run [container] [command]`

```sh
wp-env run <container> [command..]

Runs an arbitrary command in one of the underlying Docker containers, for
example it's useful for running wp cli commands.


Positionals:
draganescu marked this conversation as resolved.
Show resolved Hide resolved
container The container to run the command on. [string] [required]
command The command to run. [array] [default: []]
```

For example:

```sh
wp-env run cli wp user list
⠏ Running `wp user list` in 'cli'.

ID user_login display_name user_email user_registered roles
1 admin admin [email protected] 2020-03-05 10:45:14 administrator

✔ Ran `wp user list` in 'cli'. (in 2s 374ms)
```

## .wp-env.json

You can customize the WordPress installation, plugins and themes that the development environment will use by specifying a `.wp-env.json` file in the directory that you run `wp-env` from.
Expand Down
6 changes: 5 additions & 1 deletion packages/env/lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ module.exports = function cli() {
);
yargs.command(
'run <container> [command..]',
'Runs an arbitrary command in one of the underlying Docker containers.',
"Runs an arbitrary command in one of the underlying Docker containers, for example it's useful for running wp cli commands.",
( args ) => {
args.positional( 'container', {
type: 'string',
Expand All @@ -124,6 +124,10 @@ module.exports = function cli() {
},
withSpinner( env.run )
);
yargs.example(
'$0 run cli wp user list',
'Runs `wp user list` wp-cli command which lists WordPress users.'
);

return yargs;
};