mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-25 18:45:27 -06:00
Replaced cli execution using expressive middleware by symfony/console
This commit is contained in:
17
bin/cli
17
bin/cli
@@ -1,17 +1,14 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
use Acelaya\UrlShortener\CliCommands\GenerateShortcodeCommand;
|
||||
use Interop\Container\ContainerInterface;
|
||||
use Zend\Diactoros\ServerRequestFactory;
|
||||
use Zend\Diactoros\Uri;
|
||||
use Zend\Expressive\Application;
|
||||
use Symfony\Component\Console\Application as CliApp;
|
||||
|
||||
/** @var ContainerInterface $container */
|
||||
$container = include __DIR__ . '/../config/container.php';
|
||||
/** @var Application $app */
|
||||
$app = $container->get(Application::class);
|
||||
|
||||
$command = count($_SERVER['argv']) > 1 ? $_SERVER['argv'][1] : '';
|
||||
$request = ServerRequestFactory::fromGlobals()
|
||||
->withMethod('CLI')
|
||||
->withUri(new Uri(sprintf('/%s', $command)));
|
||||
$app->run($request);
|
||||
$app = new CliApp();
|
||||
$app->addCommands([
|
||||
$container->get(GenerateShortcodeCommand::class),
|
||||
]);
|
||||
$app->run();
|
||||
|
||||
Reference in New Issue
Block a user