-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathsloth-cli.php
More file actions
28 lines (20 loc) · 783 Bytes
/
sloth-cli.php
File metadata and controls
28 lines (20 loc) · 783 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
#!/usr/bin/php -q
<?php
namespace Sloth\Scaffolder;
require __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
require __DIR__ . DIRECTORY_SEPARATOR . 'bootstrap.php';
use Sloth\Utility\Utility;
use League\CLImate\CLImate;
if (! isset($argv[1])) {
throw new \Exception('Please give an action! E.g. sloth.php build_module');
}
$scaffolder = new Scaffolder();
$climate = new CLImate();
$scaffold_action = Utility::underscore($argv[1]);
if (method_exists($scaffolder, $scaffold_action)) {
define('WP_USE_THEMES', true);
include($scaffolder->_get_wordpress_install_dir() . 'wp-load.php');
call_user_func([ $scaffolder, $scaffold_action ]);
} else {
$climate->error(sprintf('Unknown action %s', $scaffold_action));
}