|
2 | 2 |
|
3 | 3 | namespace Botble\GitCommitChecker\Commands; |
4 | 4 |
|
| 5 | +use Illuminate\Console\Application; |
5 | 6 | use Illuminate\Console\Command; |
6 | 7 | use Illuminate\Console\ConfirmableTrait; |
7 | 8 | use Symfony\Component\Console\Attribute\AsCommand; |
@@ -35,14 +36,14 @@ public function handle(): int |
35 | 36 | $pintConfigFilePath = $this->laravel->basePath('pint.json'); |
36 | 37 |
|
37 | 38 | if ($this->laravel['files']->exists($pintConfigFilePath)) { |
38 | | - if ($this->components->confirm('A pint.json exists. Do you want to overwrite this file?')) { |
| 39 | + if ($this->components->confirm('A <comment>pint.json</comment> exists. Do you want to overwrite this file?')) { |
39 | 40 | $this->generatePintConfiguration($pintConfigFilePath); |
40 | 41 | } |
41 | 42 |
|
42 | 43 | return self::SUCCESS; |
43 | 44 | } |
44 | 45 |
|
45 | | - if ($this->components->confirm('A pint.json does not exists. Do you want to create this file?')) { |
| 46 | + if ($this->components->confirm('A <comment>pint.json</comment> does not exists. Do you want to create this file?')) { |
46 | 47 | $this->generatePintConfiguration($pintConfigFilePath); |
47 | 48 | } |
48 | 49 |
|
@@ -79,9 +80,7 @@ protected function install(string $hook, string $class): bool |
79 | 80 |
|
80 | 81 | protected function generateHookScript(string $signature): string |
81 | 82 | { |
82 | | - $artisan = addslashes($this->laravel->basePath('artisan')); |
83 | | - |
84 | | - return "#!/bin/sh\n\nphp $artisan $signature\n"; |
| 83 | + return sprintf("#!/bin/sh\n\n%s\n", Application::formatCommandString($signature)); |
85 | 84 | } |
86 | 85 |
|
87 | 86 | protected function generatePintConfiguration(string $path): void |
@@ -110,7 +109,9 @@ protected function generatePintConfiguration(string $path): void |
110 | 109 | abort(1); |
111 | 110 | } |
112 | 111 |
|
113 | | - $this->components->info("Created [$path] using $presets[$preset] preset successfully"); |
| 112 | + $this->components->info( |
| 113 | + "Created <comment>$path</comment> using <comment>$presets[$preset]</comment> preset successfully" |
| 114 | + ); |
114 | 115 | } |
115 | 116 |
|
116 | 117 | protected function writeHookScript(string $path, string $script): bool |
|
0 commit comments