diff --git a/README.md b/README.md index 36929e3..5db3f06 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,18 @@ Tool to reset WordPress database. This reset WP database but retains given admin Quick links: [Using](#using) | [Installing](#installing) | [Contributing](#contributing) +TOC will be here. + ## Using +This package implements the following commands: + + +### wp database reset + +Reset database content except one administrator user. + ~~~ wp database reset --author= ~~~ @@ -23,6 +32,16 @@ wp database reset --author= # Reset database and keep `admin` user. $ wp database reset --author=admin + + +### wp database test + +Reset database content except one administrator user. + +~~~ +wp database test +~~~ + ## Installing Installing this package requires WP-CLI v2.9 or greater. Update to the latest stable release with `wp cli update`. diff --git a/command.php b/command.php index 3e14387..c5e883c 100644 --- a/command.php +++ b/command.php @@ -14,4 +14,5 @@ require_once $wpcli_database_command_autoloader; } -WP_CLI::add_command( 'database', DatabaseCommand::class ); +WP_CLI::add_command( 'database reset', [ DatabaseCommand::class, 'reset' ] ); +WP_CLI::add_command( 'database test', [ DatabaseCommand::class, 'test' ] ); diff --git a/composer.json b/composer.json index 247337a..175596f 100644 --- a/composer.json +++ b/composer.json @@ -43,7 +43,8 @@ }, "extra": { "commands": [ - "database reset" + "database reset", + "database test" ], "readme": { "sections": [ diff --git a/src/DatabaseCommand.php b/src/DatabaseCommand.php index 7acfaec..9710bfa 100644 --- a/src/DatabaseCommand.php +++ b/src/DatabaseCommand.php @@ -22,6 +22,8 @@ class DatabaseCommand extends WP_CLI_Command { * * @when after_wp_load * + * @subcommand reset + * * @param array $args Indexed array of positional arguments. * @param array $assoc_args Associative array of associative arguments. */ @@ -52,6 +54,19 @@ public function reset( $args, $assoc_args ) { $this->reset_callback( $author_obj ); } + /** + * Reset database content except one administrator user. + * + * @when after_wp_load + * + * @subcommand test + * + * @param array $args Indexed array of positional arguments. + * @param array $assoc_args Associative array of associative arguments. + */ + public function test( $args, $assoc_args ) { + } + /** * Reset database. *