mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-27 01:39:22 +02:00

Usage: php ma list php ma cache:clear php ma plugin:install guild-wars.zip More sophisticated: echo "Hello, this is hello world message" | php ma mail:send test@test.com --subject "This is subject" Also: custom commands can be added via Plugins: just need to return new class instance that extends \MyAAC\Commands\Command in plugins/*/commands folder
38 lines
820 B
PHP
38 lines
820 B
PHP
#!/usr/bin/env php
|
|
<?php
|
|
|
|
require_once __DIR__ . '/common.php';
|
|
|
|
if(!IS_CLI) {
|
|
echo 'This script can be run only in command line mode.';
|
|
exit(1);
|
|
}
|
|
|
|
require_once SYSTEM . 'functions.php';
|
|
require_once SYSTEM . 'init.php';
|
|
|
|
use Symfony\Component\Console\Application;
|
|
|
|
$application = new Application();
|
|
|
|
$commandsGlob = glob(SYSTEM . 'src/Commands/*.php');
|
|
foreach ($commandsGlob as $item) {
|
|
$name = pathinfo($item, PATHINFO_FILENAME);
|
|
if ($name == 'Command') { // ignore base Command class
|
|
continue;
|
|
}
|
|
|
|
$commandPre = '\\MyAAC\Commands\\';
|
|
$application->add(new ($commandPre . $name));
|
|
}
|
|
|
|
$pluginCommands = glob(PLUGINS . '*/commands/*.php');
|
|
foreach ($pluginCommands as $item) {
|
|
$application->add(require $item);
|
|
}
|
|
|
|
$application->setName('MyAAC');
|
|
$application->setVersion(MYAAC_VERSION);
|
|
|
|
$application->run();
|