Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions src/MakePotCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,18 @@ class MakePotCommand extends WP_CLI_Command {
* @when before_wp_load
*/
public function __invoke( $args, $assoc_args ) {
$this->handle_arguments( $args, $assoc_args );
if ( ! $this->makepot() ) {
WP_CLI::error( 'Could not generate a POT file!' );
}

WP_CLI::success( 'POT file successfully generated!' );
}

/**
* Process arguments from command-line in a reusable way.
*/
public function handle_arguments( $args, $assoc_args ) {
$array_arguments = array( 'headers' );
$assoc_args = \WP_CLI\Utils\parse_shell_arrays( $assoc_args, $array_arguments );
$this->source = realpath( $args[0] );
Expand Down Expand Up @@ -173,12 +185,6 @@ public function __invoke( $args, $assoc_args ) {
$this->exclude = array_map( [ $this, 'unslashit' ], $this->exclude);
$this->exclude = array_unique( $this->exclude );
}

if ( ! $this->makepot() ) {
WP_CLI::error( 'Could not generate a POT file!' );
}

WP_CLI::success( 'POT file successfully generated!' );
}

/**
Expand Down