Skip to content

Commit

Permalink
Merge pull request #67 from DrewAPicture/issue/doc-verbs
Browse files Browse the repository at this point in the history
Convert db command help summaries to use third-person singular verbs.
  • Loading branch information
danielbachhuber authored Dec 6, 2017
2 parents 56b1ba5 + 63db6a7 commit 87d5645
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 29 deletions.
53 changes: 40 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,36 @@ Quick links: [Using](#using) | [Installing](#installing) | [Contributing](#contr

This package implements the following commands:

### wp db

Performs basic database operations using credentials stored in wp-config.php.

~~~
wp db
~~~

**EXAMPLES**

# Create a new database.
$ wp db create
Success: Database created.

# Drop an existing database.
$ wp db drop --yes
Success: Database dropped.

# Reset the current database.
$ wp db reset --yes
Success: Database reset.

# Execute a SQL query stored in a file.
$ wp db query < debug.sql



### wp db create

Create a new database.
Creates a new database.

~~~
wp db create
Expand All @@ -32,7 +59,7 @@ wp-config.php.

### wp db drop

Delete the existing database.
Deletes the existing database.

~~~
wp db drop [--yes]
Expand All @@ -56,7 +83,7 @@ wp-config.php.

### wp db reset

Remove all tables from the database.
Removes all tables from the database.

~~~
wp db reset [--yes]
Expand All @@ -80,7 +107,7 @@ specified in wp-config.php.

### wp db check

Check the current status of the database.
Checks the current status of the database.

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

### wp db optimize

Optimize the database.
Optimizes the database.

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

### wp db prefix

Display the database table prefix.
Displays the database table prefix.

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

### wp db repair

Repair the database.
Repairs the database.

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

### wp db cli

Open a MySQL console using credentials from wp-config.php
Opens a MySQL console using credentials from wp-config.php

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

### wp db query

Execute a SQL query against the database.
Executes a SQL query against the database.

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

### wp db import

Import a database from a file or from STDIN.
Imports a database from a file or from STDIN.

~~~
wp db import [<file>] [--skip-optimization]
Expand Down Expand Up @@ -340,7 +367,7 @@ defined in the SQL.

### wp db search

Find a string in the database.
Finds a string in the database.

~~~
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>]
Expand Down Expand Up @@ -468,7 +495,7 @@ They can be concatenated. For instance, the default match color of black on a mu

### wp db tables

List the database tables.
Lists the database tables.

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

### wp db size

Display the database name and size.
Displays the database name and size.

~~~
wp db size [--size_format] [--tables] [--format] [--scope=<scope>] [--network] [--all-tables-with-prefix] [--all-tables]
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
},
"bundled": true,
"commands": [
"db",
"db create",
"db drop",
"db reset",
Expand Down
32 changes: 16 additions & 16 deletions src/DB_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use \WP_CLI\Utils;

/**
* Perform basic database operations using credentials stored in wp-config.php
* Performs basic database operations using credentials stored in wp-config.php.
*
* ## EXAMPLES
*
Expand All @@ -27,7 +27,7 @@
class DB_Command extends WP_CLI_Command {

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

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

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

/**
* Check the current status of the database.
* Checks the current status of the database.
*
* Runs `mysqlcheck` utility with `--check` using `DB_HOST`,
* `DB_NAME`, `DB_USER` and `DB_PASSWORD` database credentials
Expand All @@ -120,7 +120,7 @@ public function check() {
}

/**
* Optimize the database.
* Optimizes the database.
*
* Runs `mysqlcheck` utility with `--optimize=true` using `DB_HOST`,
* `DB_NAME`, `DB_USER` and `DB_PASSWORD` database credentials
Expand All @@ -143,7 +143,7 @@ public function optimize() {
}

/**
* Repair the database.
* Repairs the database.
*
* Runs `mysqlcheck` utility with `--repair=true` using `DB_HOST`,
* `DB_NAME`, `DB_USER` and `DB_PASSWORD` database credentials
Expand All @@ -166,7 +166,7 @@ public function repair() {
}

/**
* Open a MySQL console using credentials from wp-config.php
* Opens a MySQL console using credentials from wp-config.php
*
* ## OPTIONS
*
Expand Down Expand Up @@ -196,7 +196,7 @@ public function cli( $args, $assoc_args ) {
}

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

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

/**
* List the database tables.
* Lists the database tables.
*
* Defaults to all tables registered to the $wpdb database handler.
*
Expand Down Expand Up @@ -495,7 +495,7 @@ public function tables( $args, $assoc_args ) {
}

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

/**
* Display the database table prefix.
* Displays the database table prefix.
*
* Display the database table prefix, as defined by the database handler's interpretation of the current site.
*
Expand All @@ -689,7 +689,7 @@ public function prefix() {
}

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

/**
* Get the column names of a db table differentiated into key columns and text columns and all columns.
* Gets the column names of a db table differentiated into key columns and text columns and all columns.
*
* @param string $table The table name.
* @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.
Expand All @@ -1049,7 +1049,7 @@ private static function get_columns( $table ) {
}

/**
* Whether a column is considered text or not.
* Determines whether a column is considered text or not.
*
* @param string Column type.
* @bool True if text column, false otherwise.
Expand Down

0 comments on commit 87d5645

Please sign in to comment.