Command ContainerLoader
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
function loadCommands(&$app): void {
|
/*function loadCommands(&$app): void {
|
||||||
$files = new FilesystemIterator($app->getContainer()->get('folders')->commands);
|
$files = new FilesystemIterator($app->getContainer()->get('folders')->commands);
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
if ($file->isDir()) {
|
if ($file->isDir()) {
|
||||||
@ -8,4 +8,6 @@ function loadCommands(&$app): void {
|
|||||||
include_once $file->getRealPath();
|
include_once $file->getRealPath();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loadCommands($app);
|
loadCommands($app);*/
|
||||||
|
$app->setCommandLoader($app->getContainer()->get(Symfony\Component\Console\CommandLoader\CommandLoaderInterface::class));
|
||||||
|
$app->setDefaultCommand('run:full');
|
||||||
|
18
cli/setup/settings/commands.php
Normal file
18
cli/setup/settings/commands.php
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
return [
|
||||||
|
'commands' => function() {
|
||||||
|
return [
|
||||||
|
'comunas' => Incoviba\Command\Comunas::class,
|
||||||
|
'contabilidad:cartolas:update' => Incoviba\Command\Contabilidad\Cartolas\Update::class,
|
||||||
|
'money:ipc' => Incoviba\Command\Money\IPC::class,
|
||||||
|
'money:uf' => Incoviba\Command\Money\UF::class,
|
||||||
|
'money:uf:update' => Incoviba\Command\Money\UF\Update::class,
|
||||||
|
'proyectos:activos' => Incoviba\Command\Proyectos\Activos::class,
|
||||||
|
'run:full' => Incoviba\Command\Full::class,
|
||||||
|
'ventas:cierres:vigentes' => Incoviba\Command\Ventas\Cierres\Vigentes::class,
|
||||||
|
'ventas:cuotas:hoy' => Incoviba\Command\Ventas\Cuotas\Hoy::class,
|
||||||
|
'ventas:cuotas:pendientes' => Incoviba\Command\Ventas\Cuotas\Pendientes::class,
|
||||||
|
'ventas:cuotas:vencer' => Incoviba\Command\Ventas\Cuotas\PorVencer::class,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
15
cli/setup/setups/commands.php
Normal file
15
cli/setup/setups/commands.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
use Psr\Container\ContainerInterface;
|
||||||
|
|
||||||
|
return [
|
||||||
|
Symfony\Component\Console\CommandLoader\CommandLoaderInterface::class => function(ContainerInterface $container) {
|
||||||
|
return new Symfony\Component\Console\CommandLoader\ContainerCommandLoader($container, $container->get('commands'));
|
||||||
|
},
|
||||||
|
Incoviba\Command\Full::class => function(ContainerInterface $container) {
|
||||||
|
return new Incoviba\Command\Full(
|
||||||
|
$container->get(Psr\Http\Client\ClientInterface::class),
|
||||||
|
$container->get(Psr\Log\LoggerInterface::class),
|
||||||
|
$container->get('commands')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
];
|
Reference in New Issue
Block a user