改名
This commit is contained in:
+29
-22
@@ -15,9 +15,7 @@ use Console\Console;
|
|||||||
use Console\ConsoleProviders;
|
use Console\ConsoleProviders;
|
||||||
use Database\DatabasesProviders;
|
use Database\DatabasesProviders;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Server\ServerCommand;
|
|
||||||
use Http\Context\Response;
|
use Http\Context\Response;
|
||||||
use Server\ServerProviders;
|
|
||||||
use Kiri\Abstracts\BaseApplication;
|
use Kiri\Abstracts\BaseApplication;
|
||||||
use Kiri\Abstracts\Config;
|
use Kiri\Abstracts\Config;
|
||||||
use Kiri\Abstracts\Kernel;
|
use Kiri\Abstracts\Kernel;
|
||||||
@@ -26,9 +24,12 @@ use Kiri\Exception\NotFindClassException;
|
|||||||
use Kiri\FileListen\FileChangeCustomProcess;
|
use Kiri\FileListen\FileChangeCustomProcess;
|
||||||
use ReflectionException;
|
use ReflectionException;
|
||||||
use Server\ResponseInterface;
|
use Server\ResponseInterface;
|
||||||
|
use Server\ServerCommand;
|
||||||
|
use Server\ServerProviders;
|
||||||
use stdClass;
|
use stdClass;
|
||||||
use Swoole\Process;
|
use Swoole\Process;
|
||||||
use Swoole\Timer;
|
use Swoole\Timer;
|
||||||
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\ArgvInput;
|
use Symfony\Component\Console\Input\ArgvInput;
|
||||||
use Symfony\Component\Console\Output\ConsoleOutput;
|
use Symfony\Component\Console\Output\ConsoleOutput;
|
||||||
|
|
||||||
@@ -62,6 +63,8 @@ class Application extends BaseApplication
|
|||||||
{
|
{
|
||||||
$this->import(ConsoleProviders::class);
|
$this->import(ConsoleProviders::class);
|
||||||
$this->import(ServerProviders::class);
|
$this->import(ServerProviders::class);
|
||||||
|
|
||||||
|
$this->register(Runtime::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -206,43 +209,47 @@ class Application extends BaseApplication
|
|||||||
*/
|
*/
|
||||||
public function execute(array $argv): void
|
public function execute(array $argv): void
|
||||||
{
|
{
|
||||||
|
[$input, $output] = $this->argument($argv);
|
||||||
try {
|
try {
|
||||||
$this->register(Runtime::class);
|
|
||||||
|
|
||||||
$input = new ArgvInput($argv);
|
|
||||||
|
|
||||||
$console = di(\Symfony\Component\Console\Application::class);
|
$console = di(\Symfony\Component\Console\Application::class);
|
||||||
$command = $console->find($input->getFirstArgument());
|
$command = $input->getFirstArgument();
|
||||||
|
if (!empty($command)) {
|
||||||
// /** @var Console $manager */
|
$command = 'list';
|
||||||
// $manager = Kiri::app()->get('console');
|
}
|
||||||
// $class = $manager->setParameters($argv)->search();
|
$command = $console->find($command);
|
||||||
|
if ($command instanceof Command) {
|
||||||
$command->run($input, $output = new ConsoleOutput());
|
$this->enableFileChange($command, $input, $output);
|
||||||
|
}
|
||||||
$this->enableFileChange($command);
|
|
||||||
|
|
||||||
$data = $output->getStream();
|
|
||||||
|
|
||||||
// $data = $this->getBuilder($manager->exec($class));
|
|
||||||
} catch (\Throwable $exception) {
|
} catch (\Throwable $exception) {
|
||||||
$data = $this->getBuilder(jTraceEx($exception));
|
$output->writeln(jTraceEx($exception));
|
||||||
} finally {
|
} finally {
|
||||||
print_r($data);
|
|
||||||
Timer::clearAll();
|
Timer::clearAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $argv
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
private function argument($argv): array
|
||||||
|
{
|
||||||
|
return [new ArgvInput($argv), new ConsoleOutput()];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws NotFindClassException
|
* @throws NotFindClassException
|
||||||
* @throws ReflectionException
|
* @throws ReflectionException
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private function enableFileChange($class): void
|
private function enableFileChange(Command $class, $input, $output): void
|
||||||
{
|
{
|
||||||
if (!($class instanceof ServerCommand)) {
|
if (!($class instanceof ServerCommand)) {
|
||||||
scan_directory(directory('app'), 'App');
|
scan_directory(directory('app'), 'App');
|
||||||
}
|
}
|
||||||
|
$class->run($input, $output);
|
||||||
|
$output->writeln('ok');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user