Skip to content

Commit a7ac3c2

Browse files
Merge pull request #67 from DrewAPicture/issue/doc-verbs
Convert db command help summaries to use third-person singular verbs.
2 parents a8a4a9d + 0b075d4 commit a7ac3c2

File tree

3 files changed

+57
-29
lines changed

3 files changed

+57
-29
lines changed

README.md

Lines changed: 40 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,36 @@ Quick links: [Using](#using) | [Installing](#installing) | [Contributing](#contr
1111

1212
This package implements the following commands:
1313

14+
### wp db
15+
16+
Performs basic database operations using credentials stored in wp-config.php.
17+
18+
~~~
19+
wp db
20+
~~~
21+
22+
**EXAMPLES**
23+
24+
# Create a new database.
25+
$ wp db create
26+
Success: Database created.
27+
28+
# Drop an existing database.
29+
$ wp db drop --yes
30+
Success: Database dropped.
31+
32+
# Reset the current database.
33+
$ wp db reset --yes
34+
Success: Database reset.
35+
36+
# Execute a SQL query stored in a file.
37+
$ wp db query < debug.sql
38+
39+
40+
1441
### wp db create
1542

16-
Create a new database.
43+
Creates a new database.
1744

1845
~~~
1946
wp db create
@@ -32,7 +59,7 @@ wp-config.php.
3259

3360
### wp db drop
3461

35-
Delete the existing database.
62+
Deletes the existing database.
3663

3764
~~~
3865
wp db drop [--yes]
@@ -56,7 +83,7 @@ wp-config.php.
5683

5784
### wp db reset
5885

59-
Remove all tables from the database.
86+
Removes all tables from the database.
6087

6188
~~~
6289
wp db reset [--yes]
@@ -80,7 +107,7 @@ specified in wp-config.php.
80107

81108
### wp db check
82109

83-
Check the current status of the database.
110+
Checks the current status of the database.
84111

85112
~~~
86113
wp db check
@@ -102,7 +129,7 @@ for more details on the `CHECK TABLE` statement.
102129

103130
### wp db optimize
104131

105-
Optimize the database.
132+
Optimizes the database.
106133

107134
~~~
108135
wp db optimize
@@ -124,7 +151,7 @@ for more details on the `OPTIMIZE TABLE` statement.
124151

125152
### wp db prefix
126153

127-
Display the database table prefix.
154+
Displays the database table prefix.
128155

129156
~~~
130157
wp db prefix
@@ -141,7 +168,7 @@ Display the database table prefix, as defined by the database handler's interpre
141168

142169
### wp db repair
143170

144-
Repair the database.
171+
Repairs the database.
145172

146173
~~~
147174
wp db repair
@@ -163,7 +190,7 @@ more details on the `REPAIR TABLE` statement.
163190

164191
### wp db cli
165192

166-
Open a MySQL console using credentials from wp-config.php
193+
Opens a MySQL console using credentials from wp-config.php
167194

168195
~~~
169196
wp db cli [--database=<database>] [--default-character-set=<character-set>] [--<field>=<value>]
@@ -190,7 +217,7 @@ wp db cli [--database=<database>] [--default-character-set=<character-set>] [--<
190217

191218
### wp db query
192219

193-
Execute a SQL query against the database.
220+
Executes a SQL query against the database.
194221

195222
~~~
196223
wp db query [<sql>] [--<field>=<value>]
@@ -311,7 +338,7 @@ Runs `mysqldump` utility using `DB_HOST`, `DB_NAME`, `DB_USER` and
311338

312339
### wp db import
313340

314-
Import a database from a file or from STDIN.
341+
Imports a database from a file or from STDIN.
315342

316343
~~~
317344
wp db import [<file>] [--skip-optimization]
@@ -340,7 +367,7 @@ defined in the SQL.
340367

341368
### wp db search
342369

343-
Find a string in the database.
370+
Finds a string in the database.
344371

345372
~~~
346373
wp db search <search> [<tables>...] [--network] [--all-tables-with-prefix] [--all-tables] [--before_context=<num>] [--after_context=<num>] [--regex] [--regex-flags=<regex-flags>] [--regex-delimiter=<regex-delimiter>] [--table_column_once] [--one_line] [--matches_only] [--stats] [--table_column_color=<color_code>] [--id_color=<color_code>] [--match_color=<color_code>]
@@ -468,7 +495,7 @@ They can be concatenated. For instance, the default match color of black on a mu
468495

469496
### wp db tables
470497

471-
List the database tables.
498+
Lists the database tables.
472499

473500
~~~
474501
wp db tables [<table>...] [--scope=<scope>] [--network] [--all-tables-with-prefix] [--all-tables] [--format=<format>]
@@ -524,7 +551,7 @@ Defaults to all tables registered to the $wpdb database handler.
524551

525552
### wp db size
526553

527-
Display the database name and size.
554+
Displays the database name and size.
528555

529556
~~~
530557
wp db size [--size_format] [--tables] [--format] [--scope=<scope>] [--network] [--all-tables-with-prefix] [--all-tables]

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
},
3333
"bundled": true,
3434
"commands": [
35+
"db",
3536
"db create",
3637
"db drop",
3738
"db reset",

src/DB_Command.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use \WP_CLI\Utils;
44

55
/**
6-
* Perform basic database operations using credentials stored in wp-config.php
6+
* Performs basic database operations using credentials stored in wp-config.php.
77
*
88
* ## EXAMPLES
99
*
@@ -27,7 +27,7 @@
2727
class DB_Command extends WP_CLI_Command {
2828

2929
/**
30-
* Create a new database.
30+
* Creates a new database.
3131
*
3232
* Runs `CREATE_DATABASE` SQL statement using `DB_HOST`, `DB_NAME`,
3333
* `DB_USER` and `DB_PASSWORD` database credentials specified in
@@ -46,7 +46,7 @@ public function create( $_, $assoc_args ) {
4646
}
4747

4848
/**
49-
* Delete the existing database.
49+
* Deletes the existing database.
5050
*
5151
* Runs `DROP_DATABASE` SQL statement using `DB_HOST`, `DB_NAME`,
5252
* `DB_USER` and `DB_PASSWORD` database credentials specified in
@@ -71,7 +71,7 @@ public function drop( $_, $assoc_args ) {
7171
}
7272

7373
/**
74-
* Remove all tables from the database.
74+
* Removes all tables from the database.
7575
*
7676
* Runs `DROP_DATABASE` and `CREATE_DATABASE` SQL statements using
7777
* `DB_HOST`, `DB_NAME`, `DB_USER` and `DB_PASSWORD` database credentials
@@ -97,7 +97,7 @@ public function reset( $_, $assoc_args ) {
9797
}
9898

9999
/**
100-
* Check the current status of the database.
100+
* Checks the current status of the database.
101101
*
102102
* Runs `mysqlcheck` utility with `--check` using `DB_HOST`,
103103
* `DB_NAME`, `DB_USER` and `DB_PASSWORD` database credentials
@@ -120,7 +120,7 @@ public function check() {
120120
}
121121

122122
/**
123-
* Optimize the database.
123+
* Optimizes the database.
124124
*
125125
* Runs `mysqlcheck` utility with `--optimize=true` using `DB_HOST`,
126126
* `DB_NAME`, `DB_USER` and `DB_PASSWORD` database credentials
@@ -143,7 +143,7 @@ public function optimize() {
143143
}
144144

145145
/**
146-
* Repair the database.
146+
* Repairs the database.
147147
*
148148
* Runs `mysqlcheck` utility with `--repair=true` using `DB_HOST`,
149149
* `DB_NAME`, `DB_USER` and `DB_PASSWORD` database credentials
@@ -166,7 +166,7 @@ public function repair() {
166166
}
167167

168168
/**
169-
* Open a MySQL console using credentials from wp-config.php
169+
* Opens a MySQL console using credentials from wp-config.php
170170
*
171171
* ## OPTIONS
172172
*
@@ -196,7 +196,7 @@ public function cli( $args, $assoc_args ) {
196196
}
197197

198198
/**
199-
* Execute a SQL query against the database.
199+
* Executes a SQL query against the database.
200200
*
201201
* Executes an arbitrary SQL query using `DB_HOST`, `DB_NAME`, `DB_USER`
202202
* and `DB_PASSWORD` database credentials specified in wp-config.php.
@@ -374,7 +374,7 @@ public function export( $args, $assoc_args ) {
374374
}
375375

376376
/**
377-
* Import a database from a file or from STDIN.
377+
* Imports a database from a file or from STDIN.
378378
*
379379
* Runs SQL queries using `DB_HOST`, `DB_NAME`, `DB_USER` and
380380
* `DB_PASSWORD` database credentials specified in wp-config.php. This
@@ -424,7 +424,7 @@ public function import( $args, $assoc_args ) {
424424
}
425425

426426
/**
427-
* List the database tables.
427+
* Lists the database tables.
428428
*
429429
* Defaults to all tables registered to the $wpdb database handler.
430430
*
@@ -495,7 +495,7 @@ public function tables( $args, $assoc_args ) {
495495
}
496496

497497
/**
498-
* Display the database name and size.
498+
* Displays the database name and size.
499499
*
500500
* Display the database name and size for `DB_NAME` specified in wp-config.php.
501501
* The size defaults to a human-readable number.
@@ -671,7 +671,7 @@ public function size( $args, $assoc_args ) {
671671
}
672672

673673
/**
674-
* Display the database table prefix.
674+
* Displays the database table prefix.
675675
*
676676
* Display the database table prefix, as defined by the database handler's interpretation of the current site.
677677
*
@@ -689,7 +689,7 @@ public function prefix() {
689689
}
690690

691691
/**
692-
* Find a string in the database.
692+
* Finds a string in the database.
693693
*
694694
* Searches through all or a selection of database tables for a given string, Outputs colorized references to the string.
695695
*
@@ -1022,7 +1022,7 @@ private static function run( $cmd, $assoc_args = array(), $descriptors = null )
10221022
}
10231023

10241024
/**
1025-
* Get the column names of a db table differentiated into key columns and text columns and all columns.
1025+
* Gets the column names of a db table differentiated into key columns and text columns and all columns.
10261026
*
10271027
* @param string $table The table name.
10281028
* @return array A 3 element array consisting of an array of primary key column names, an array of text column names, and an array containing all column names.
@@ -1049,7 +1049,7 @@ private static function get_columns( $table ) {
10491049
}
10501050

10511051
/**
1052-
* Whether a column is considered text or not.
1052+
* Determines whether a column is considered text or not.
10531053
*
10541054
* @param string Column type.
10551055
* @bool True if text column, false otherwise.

0 commit comments

Comments
 (0)