-
Notifications
You must be signed in to change notification settings - Fork 0
/
Theme.pm
46 lines (37 loc) · 885 Bytes
/
Theme.pm
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
34
35
36
37
38
39
40
41
42
43
44
45
46
#
# Paulo Graça <[email protected]>
#
package Rex::Module::CMS::WP_CLI::Theme;
use Rex::Commands;
use Rex::Module::CMS::WP_CLI;
our $WP_CLI_COMMAND = 'theme';
sub _execute {
my @params = @_;
my $param;
if ( ref $params[0] eq "HASH" ) {
$param = $params[0];
} else {
$param = {@params};
}
my @action = split(/\:/, $param->{task});
Rex::Module::CMS::WP_CLI::execute (
Rex::Module::CMS::WP_CLI::buildCommand(
command => $WP_CLI_COMMAND,
subcommand => $action[$#action],
parameters => $param,
), $param );
};
my @subcommands = qw( install delete activate update );
foreach my $subcommand (@subcommands) {
desc "$subcommand $WP_CLI_COMMAND";
task "$subcommand",
sub {
_execute(
task => task->name,
subparams => @_);
};
}
desc "alias for install";
task "setup" => sub {
_execute('install', @_);
};