From c896e4ff6db005421807087b74b1cffa6841523b Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Tue, 19 Sep 2023 09:19:17 +0800 Subject: [PATCH 1/2] wip Signed-off-by: Mior Muhammad Zaki --- src/Concerns/CodeGenerator.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Concerns/CodeGenerator.php b/src/Concerns/CodeGenerator.php index 945917c..16d3e0f 100644 --- a/src/Concerns/CodeGenerator.php +++ b/src/Concerns/CodeGenerator.php @@ -69,7 +69,7 @@ public function codeAlreadyExists(string $className, string $path): bool { $this->components->error( sprintf( - '%s [%s] already exists!', $this->type, Str::after($path, $this->generatorPreset()->basePath()) + '%s [%s] already exists!', $this->type, Str::after($path, $this->generatorPreset()->basePath().DIRECTORY_SEPARATOR) ) ); @@ -83,7 +83,7 @@ public function codeHasBeenGenerated(string $className, string $path): bool { $this->components->info( sprintf( - '%s [%s] created successfully.', $this->type, Str::after($path, $this->generatorPreset()->basePath()) + '%s [%s] created successfully.', $this->type, Str::after($path, $this->generatorPreset()->basePath().DIRECTORY_SEPARATOR) ) ); From 1fa9cfce1b52e3a4161588ad8ee31dcc93123fce Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Tue, 19 Sep 2023 09:32:04 +0800 Subject: [PATCH 2/2] wip Signed-off-by: Mior Muhammad Zaki --- src/Concerns/CreatesUsingGeneratorPreset.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Concerns/CreatesUsingGeneratorPreset.php b/src/Concerns/CreatesUsingGeneratorPreset.php index 82df7dd..0df0ca1 100644 --- a/src/Concerns/CreatesUsingGeneratorPreset.php +++ b/src/Concerns/CreatesUsingGeneratorPreset.php @@ -16,11 +16,17 @@ trait CreatesUsingGeneratorPreset */ protected function addGeneratorPresetOptions() { + $message = 'to running the command'; + + if (property_exists($this, 'type') && ! empty($this->type)) { + $message = 'when generating '.Str::lower($this->type); + } + $this->getDefinition()->addOption(new InputOption( 'preset', null, InputOption::VALUE_OPTIONAL, - sprintf('Preset used when generating %s', Str::lower($this->type)), + sprintf('Preset used %s', $message), null, )); }