Skip to content

Commit

Permalink
Document default login credentials and wp-env run command (#20678)
Browse files Browse the repository at this point in the history
* Document default login credentials and run command

* Add more descriptive CLI help messages

* Update README.md

* Update wording in `run` command description

* Fix typo in cli.js

* Fix linting errors

* Remove extra ;

* Whitespace
  • Loading branch information
adamziel authored Mar 16, 2020
1 parent ed53b0f commit e8b5c2e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
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:
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;
};

0 comments on commit e8b5c2e

Please sign in to comment.