From 840962c5aeaf42d6af4a62ede95f60458e985a35 Mon Sep 17 00:00:00 2001 From: Nilambar Sharma Date: Sun, 25 Feb 2024 17:46:52 +0545 Subject: [PATCH] Testing toc --- README.md | 23 +++++++++++++++++++++++ command.php | 3 ++- composer.json | 7 ++++++- src/DatabaseCommand.php | 15 +++++++++++++++ 4 files changed, 46 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 36929e3..ff66cc2 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,19 @@ Quick links: [Using](#using) | [Installing](#installing) | [Contributing](#contr ## Using +### Featured Commands + +- [wp database test](#wp-database-test) +- [wp database reset](#wp-database-reset) + + +This package implements the following commands: + + +### wp database reset + +Reset database content except one administrator user. + ~~~ wp database reset --author= ~~~ @@ -23,6 +36,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..cfe26cb 100644 --- a/composer.json +++ b/composer.json @@ -43,8 +43,13 @@ }, "extra": { "commands": [ - "database reset" + "database reset", + "database test" ], + "featured-commands": [ + "database test", + "database reset" + ], "readme": { "sections": [ "Using", 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. *