Skip to content

Commit 38026ac

Browse files
Copilotswissspidy
andcommitted
Load command file when generating README during scaffold
When wp scaffold package creates a new package, it now explicitly loads the command file (hello-world-command.php) before calling package-readme. This ensures the command is registered in WP-CLI so it can be properly documented in the generated README. Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
1 parent c886e71 commit 38026ac

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/ScaffoldPackageCommand.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,9 @@ public function package( $args, $assoc_args ) {
139139
}
140140

141141
if ( ! Utils\get_flag_value( $assoc_args, 'skip-readme' ) ) {
142-
WP_CLI::runcommand( "scaffold package-readme {$package_dir} {$force_flag}", array( 'launch' => false ) );
142+
// Load the command before generating the README so it can be documented
143+
$command_file = "{$package_dir}/hello-world-command.php";
144+
WP_CLI::runcommand( "scaffold package-readme {$package_dir} {$force_flag} --require={$command_file}", array( 'launch' => false ) );
143145
}
144146

145147
if ( ! Utils\get_flag_value( $assoc_args, 'skip-github' ) ) {

0 commit comments

Comments
 (0)