-
Notifications
You must be signed in to change notification settings - Fork 1
/
wpgen
34 lines (26 loc) · 759 Bytes
/
wpgen
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
#!/usr/bin/env php
<?php
/**
* wpgen
*/
// Load composer autoloader.
require __DIR__.'/vendor/autoload.php';
// Declare application constants.
define( 'APP_ROOT', __DIR__ . '/' );
// Print application logo.
echo \WPGen\Config::get()->logo();
// Create application.
$app = new Symfony\Component\Console\Application();
$app->setName('wpgen');
// Get list of files in Commands directory.
$files = scandir( __DIR__ . '/src/Commands' );
// Exclude directories.
$files = array_diff( $files, ['.', '..', 'Traits'] );
// Register commands to application.
foreach( $files as $file ) {
$class_name = str_replace( '.php', '', $file );
$class_name = 'WPGen\\Commands\\' . $class_name;
$app->add( new $class_name );
}
// Run application.
$app->run();