diff --git a/lancache-autofill b/lancache-autofill index 5919263..a17a8c0 100755 --- a/lancache-autofill +++ b/lancache-autofill @@ -2,18 +2,9 @@ load(); $dotenv->required(['DOWNLOADS_DIRECTORY', 'STEAMCMD_PATH']); -// Set up the console app -$app = new Application(new Container, new Dispatcher, '5.5'); +// Create the application +$app = new Illuminate\Foundation\Application(realpath(__DIR__)); + +// Register the console kernel +$app->singleton( + Illuminate\Contracts\Console\Kernel::class, + Zeropingheroes\LancacheAutofill\Console\Kernel::class +); + +// Register the exception handler +$app->singleton( + Illuminate\Contracts\Debug\ExceptionHandler::class, + Zeropingheroes\LancacheAutofill\Exceptions\Handler::class +); // Set up the SQLite database connection $capsule = new Capsule; @@ -34,20 +37,13 @@ $capsule->addConnection([ $capsule->setAsGlobal(); $capsule->bootEloquent(); -// Make commands available -$app->add(new InitialiseDatabase); -$app->add(new InitialiseDownloadsDirectory); +// Run the console application +$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class); +$status = $kernel->handle( + $input = new ArgvInput, + new ConsoleOutput +); -$app->add(new Initialise); -$app->add(new UpdateAppList); -$app->add(new SearchApps); -$app->add(new QueueApp); -$app->add(new QueuePopularApps); -$app->add(new ShowQueue); -$app->add(new StartDownloading); -$app->add(new AuthoriseAccount); -$app->add(new Dequeue); -$app->add(new Requeue); - -// Run the console app -$app->run(new ArgvInput(), new ConsoleOutput()); \ No newline at end of file +// Send output to the console once finished +$kernel->terminate($input, $status); +exit($status); diff --git a/src/Console/Kernel.php b/src/Console/Kernel.php new file mode 100644 index 0000000..cc82ea7 --- /dev/null +++ b/src/Console/Kernel.php @@ -0,0 +1,37 @@ +