File tree Expand file tree Collapse file tree 3 files changed +28
-4
lines changed Expand file tree Collapse file tree 3 files changed +28
-4
lines changed Original file line number Diff line number Diff line change 11/vendor /
2+ /.idea
Original file line number Diff line number Diff line change 1313class Application extends BaseApplication
1414{
1515
16+ const VERSION = '1.0.2 ' ;
17+
1618
1719 /**
1820 * Create a new Run application instance.
@@ -47,7 +49,6 @@ protected function registerBaseBindings()
4749 $ this ->instance (self ::class, $ this );
4850 $ this ->instance (Container::class, $ this );
4951
50- $ this ->instance ('files ' , new \Illuminate \Filesystem \Filesystem );
5152
5253 $ this ->singleton (PackageManifest::class, function () {
5354 return new PackageManifest (
Original file line number Diff line number Diff line change 22
33namespace Run \Exceptions ;
44
5+ use Illuminate \Console \View \Components \BulletList ;
6+ use Illuminate \Console \View \Components \Error ;
57use Illuminate \Contracts \Debug \ExceptionHandler ;
68use Throwable ;
9+ use Symfony \Component \Console \Exception \CommandNotFoundException ;
10+ use Symfony \Component \Console \Application as ConsoleApplication ;
711
812class Handler implements ExceptionHandler
913{
@@ -50,14 +54,32 @@ public function render($request, Throwable $e)
5054 /**
5155 * Render an exception to the console.
5256 *
53- * @param \Symfony\Component\Console\Output\OutputInterface $output
54- * @param \Throwable $e
57+ * @param \Symfony\Component\Console\Output\OutputInterface $output
58+ * @param \Throwable $e
5559 * @return void
5660 *
5761 * @internal This method is not meant to be used or overwritten outside the framework.
5862 */
5963 public function renderForConsole ($ output , Throwable $ e )
6064 {
61- // TODO: Implement renderForConsole() method.
65+ if ($ e instanceof CommandNotFoundException) {
66+ $ message = str ($ e ->getMessage ())->explode ('. ' )->first ();
67+
68+ if (! empty ($ alternatives = $ e ->getAlternatives ())) {
69+ $ message .= '. Did you mean one of these? ' ;
70+
71+ with (new Error ($ output ))->render ($ message );
72+ with (new BulletList ($ output ))->render ($ e ->getAlternatives ());
73+
74+ $ output ->writeln ('' );
75+ } else {
76+ with (new Error ($ output ))->render ($ message );
77+ }
78+
79+ return ;
80+ }
81+
82+ (new ConsoleApplication )->renderThrowable ($ e , $ output );
6283 }
84+
6385}
You can’t perform that action at this time.
0 commit comments