scaffold-package-command/templates/HelloWorldCommand.mustache
copilot-swe-agent[bot] 0c426ffe4c Add autoloader documentation to scaffolded packages
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
2026-02-01 17:48:49 +00:00

41 lines
999 B
Text

<?php
namespace WP_CLI\HelloWorld;
use WP_CLI;
use WP_CLI_Command;
/**
* HelloWorld command implementation.
*
* IMPORTANT: After modifying this file or adding new command classes, you need to
* regenerate the autoloader so your changes are recognized:
*
* composer dump-autoload --working-dir=$(wp package path)
*
* Alternatively, you can run `wp package update` to update your package and
* regenerate the autoloader.
*
* Learn more about Composer autoloading:
* https://getcomposer.org/doc/01-basic-usage.md#autoloading
*/
class HelloWorldCommand extends WP_CLI_Command {
/**
* Greets the world.
*
* ## EXAMPLES
*
* # Greet the world.
* $ wp hello-world
* Success: Hello World!
*
* @when before_wp_load
*
* @param array $args Indexed array of positional arguments.
* @param array $assoc_args Associative array of associative arguments.
*/
public function __invoke( $args, $assoc_args ) {
WP_CLI::success( 'Hello World!' );
}
}