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 1
1
/vendor /
2
+ /.idea
Original file line number Diff line number Diff line change 13
13
class Application extends BaseApplication
14
14
{
15
15
16
+ const VERSION = '1.0.2 ' ;
17
+
16
18
17
19
/**
18
20
* Create a new Run application instance.
@@ -47,7 +49,6 @@ protected function registerBaseBindings()
47
49
$ this ->instance (self ::class, $ this );
48
50
$ this ->instance (Container::class, $ this );
49
51
50
- $ this ->instance ('files ' , new \Illuminate \Filesystem \Filesystem );
51
52
52
53
$ this ->singleton (PackageManifest::class, function () {
53
54
return new PackageManifest (
Original file line number Diff line number Diff line change 2
2
3
3
namespace Run \Exceptions ;
4
4
5
+ use Illuminate \Console \View \Components \BulletList ;
6
+ use Illuminate \Console \View \Components \Error ;
5
7
use Illuminate \Contracts \Debug \ExceptionHandler ;
6
8
use Throwable ;
9
+ use Symfony \Component \Console \Exception \CommandNotFoundException ;
10
+ use Symfony \Component \Console \Application as ConsoleApplication ;
7
11
8
12
class Handler implements ExceptionHandler
9
13
{
@@ -50,14 +54,32 @@ public function render($request, Throwable $e)
50
54
/**
51
55
* Render an exception to the console.
52
56
*
53
- * @param \Symfony\Component\Console\Output\OutputInterface $output
54
- * @param \Throwable $e
57
+ * @param \Symfony\Component\Console\Output\OutputInterface $output
58
+ * @param \Throwable $e
55
59
* @return void
56
60
*
57
61
* @internal This method is not meant to be used or overwritten outside the framework.
58
62
*/
59
63
public function renderForConsole ($ output , Throwable $ e )
60
64
{
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 );
62
83
}
84
+
63
85
}
You can’t perform that action at this time.
0 commit comments