-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommand.php
More file actions
33 lines (26 loc) · 738 Bytes
/
command.php
File metadata and controls
33 lines (26 loc) · 738 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
use n5s\WpCliMove\Model\Alias;
if ( ! class_exists( 'WP_CLI' ) ) {
return;
}
$wp_cli_move_autoloader = __DIR__ . '/vendor/autoload.php';
if ( file_exists( $wp_cli_move_autoloader ) ) {
require_once $wp_cli_move_autoloader;
}
WP_CLI::add_command(
'move',
n5s\WpCliMove\MoveCommand::class,
[
'before_invoke' => function (): void {
$runner = WP_CLI::get_runner();
if ( in_array( Alias::LOCAL_ALIAS, array_keys( $runner->aliases ), true ) ) {
WP_CLI::error(
sprintf( '"%s" is a reserved alias name by the `move` command, Please rename your alias.', Alias::LOCAL_ALIAS )
);
}
if ( null !== $runner->alias ) {
WP_CLI::error( 'You cannot use the `move` command with an alias.' );
}
},
]
);