Skip to content

Commit

Permalink
Testing toc
Browse files Browse the repository at this point in the history
  • Loading branch information
ernilambar committed Feb 25, 2024
1 parent be157d2 commit 5442768
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 2 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ Quick links: [Using](#using) | [Installing](#installing) | [Contributing](#contr

## Using

TOC will be here
This package implements the following commands:

### wp database reset

Reset database content except one administrator user.

~~~
wp database reset --author=<username>
~~~
Expand All @@ -23,6 +30,16 @@ wp database reset --author=<username>
# 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`.
Expand Down
3 changes: 2 additions & 1 deletion command.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' ] );
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
},
"extra": {
"commands": [
"database reset"
"database reset",
"database test"
],
"readme": {
"sections": [
Expand Down
15 changes: 15 additions & 0 deletions src/DatabaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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.
*
Expand Down

0 comments on commit 5442768

Please sign in to comment.