File tree Expand file tree Collapse file tree 1 file changed +5
-15
lines changed
Expand file tree Collapse file tree 1 file changed +5
-15
lines changed Original file line number Diff line number Diff line change @@ -1675,23 +1675,13 @@ Feature: WP-CLI Commands
16751675 // Plugin Name: Custom Command
16761676
16771677 add_action( 'cli_init', function() {
1678- require_once plugin_dir_path( __FILE__ ) . '/class-custom-command.php';
1679- $command = new Custom_Command();
1680- WP_CLI::add_command( 'custom', array( $command, 'do_custom_command' ) );
1678+ WP_CLI::add_command( 'custom', 'do_custom_command' );
16811679 } );
1682- """
1683- And a wp-content/plugins/custom-command/class-custom-command.php file:
1684- """
1685- <?php
1686- class Custom_Command extends WP_CLI_Command {
1687- /**
1688- * Tell the whole world!
1689- */
1690- public function do_custom_command() {
1691- WP_CLI::success( "This command doesn't really do much, does it?" );
1680+
1681+ function do_custom_command() {
1682+ WP_CLI::success( 'Triggered the callback for the custom command.' );
16921683 }
1693- }
1694- """
1684+ """
16951685 And I run `wp plugin activate custom-command`
16961686 When I run `wp custom --help`
16971687 Then STDOUT should contain:
You can’t perform that action at this time.
0 commit comments