Skip to content

Commit 3641294

Browse files
committed
update the console kernel, Use illuminate console to use Run
1 parent 4a35bd8 commit 3641294

File tree

3 files changed

+59
-10
lines changed

3 files changed

+59
-10
lines changed

app/Console/kernel.php renamed to app/Console/Kernel.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
namespace App\Console;
44

55
use Illuminate\Console\Scheduling\Schedule;
6-
use Run\Console\Kernel as ConsoleKernel;
6+
use Run\Steps\Console\RunConsoleKernel;
77

8-
class Kernel extends ConsoleKernel
8+
class Kernel extends RunConsoleKernel
99
{
1010
/**
1111
* The Artisan commands provided by your application.
@@ -26,4 +26,15 @@ protected function schedule(Schedule $schedule)
2626
{
2727
//
2828
}
29+
/**
30+
* Register the commands for the application.
31+
*
32+
* @return void
33+
*/
34+
protected function commands()
35+
{
36+
$this->load(__DIR__.'/Commands');
37+
38+
require base_path('routes/console.php');
39+
}
2940
}

routes/console.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
use Illuminate\Foundation\Inspiring;
4+
use Illuminate\Support\Facades\Artisan;
5+
6+
/*
7+
|--------------------------------------------------------------------------
8+
| Console Routes
9+
|--------------------------------------------------------------------------
10+
|
11+
| This file is where you may define all of your Closure based console
12+
| commands. Each Closure is bound to a command instance allowing a
13+
| simple approach to interacting with each command's IO methods.
14+
|
15+
*/
16+
17+
Artisan::command('talk', function () {
18+
$this->comment(Inspiring::quote());
19+
})->purpose('Display an inspiring quote');

run

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
#!/usr/bin/env php
22
<?php
33

4-
use App\Console\Commands\CustomCommand;
5-
use Symfony\Component\Console\Application;
4+
define('RUN_START', microtime(true));
5+
6+
use Symfony\Component\Console\Input\ArgvInput;
7+
use Symfony\Component\Console\Output\ConsoleOutput;
68

79
/*
810
|--------------------------------------------------------------------------
@@ -11,13 +13,30 @@ use Symfony\Component\Console\Application;
1113
|
1214
|
1315
*/
14-
require_once __DIR__ .'/bootstrap/app.php';
16+
$app = require __DIR__.'/bootstrap/app.php';
17+
18+
/*
19+
|--------------------------------------------------------------------------
20+
| Run Console Kernel Then Handel the Command
21+
|--------------------------------------------------------------------------
22+
|
23+
|
24+
*/
25+
26+
$kernel = $app->make('Illuminate\Contracts\Console\Kernel');
1527

1628

17-
$command = new Application("RUN FrameWork Command line Interface (RunCLI) => ", "1.0.0 V");
29+
$status = $kernel->handle($input = new ArgvInput, new ConsoleOutput);
30+
31+
32+
/*
33+
|--------------------------------------------------------------------------
34+
| Shutdown The Console
35+
|--------------------------------------------------------------------------
36+
|
37+
*/
38+
39+
$kernel->terminate($input, $status);
1840

19-
// ... register commands
20-
$command->add(new CustomCommand());
21-
// ...
2241

23-
$command->run();
42+
exit($status);

0 commit comments

Comments
 (0)