From 42d77d6f9b1987449040b6c0530242bd6e9629b1 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 28 Oct 2023 09:00:24 +0900 Subject: [PATCH] fix: change make:command default $group to `App` `CodeIgniter` is already used for the framework commands. CodeIgniter env Retrieves the current environment, or set a new one. filter:check Check filters for a route. help Displays basic usage information. list Lists the available commands. namespaces Verifies your namespaces are setup correctly. publish Discovers and executes all predefined Publisher classes. routes Displays all routes. serve Launches the CodeIgniter PHP-Development Server. --- system/Commands/Generators/CommandGenerator.php | 4 ++-- tests/system/Commands/CommandGeneratorTest.php | 4 ++-- user_guide_src/source/cli/cli_generators.rst | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/system/Commands/Generators/CommandGenerator.php b/system/Commands/Generators/CommandGenerator.php index 7ccae13f7163..55755643e949 100644 --- a/system/Commands/Generators/CommandGenerator.php +++ b/system/Commands/Generators/CommandGenerator.php @@ -67,7 +67,7 @@ class CommandGenerator extends BaseCommand protected $options = [ '--command' => 'The command name. Default: "command:name"', '--type' => 'The command type. Options [basic, generator]. Default: "basic".', - '--group' => 'The command group. Default: [basic -> "CodeIgniter", generator -> "Generators"].', + '--group' => 'The command group. Default: [basic -> "App", generator -> "Generators"].', '--namespace' => 'Set root namespace. Default: "APP_NAMESPACE".', '--suffix' => 'Append the component title to the class name (e.g. User => UserCommand).', '--force' => 'Force overwrite existing file.', @@ -106,7 +106,7 @@ protected function prepare(string $class): string } if (! is_string($group)) { - $group = $type === 'generator' ? 'Generators' : 'CodeIgniter'; + $group = $type === 'generator' ? 'Generators' : 'App'; } return $this->parseTemplate( diff --git a/tests/system/Commands/CommandGeneratorTest.php b/tests/system/Commands/CommandGeneratorTest.php index 64ab5a21d2d9..aabb86f9a843 100644 --- a/tests/system/Commands/CommandGeneratorTest.php +++ b/tests/system/Commands/CommandGeneratorTest.php @@ -52,7 +52,7 @@ public function testGenerateCommand(): void $file = APPPATH . 'Commands/Deliver.php'; $this->assertFileExists($file); $contents = $this->getFileContents($file); - $this->assertStringContainsString('protected $group = \'CodeIgniter\';', $contents); + $this->assertStringContainsString('protected $group = \'App\';', $contents); $this->assertStringContainsString('protected $name = \'command:name\';', $contents); } @@ -72,7 +72,7 @@ public function testGenerateCommandWithOptionTypeBasic(): void $file = APPPATH . 'Commands/Deliver.php'; $this->assertFileExists($file); $contents = $this->getFileContents($file); - $this->assertStringContainsString('protected $group = \'CodeIgniter\';', $contents); + $this->assertStringContainsString('protected $group = \'App\';', $contents); $this->assertStringContainsString('protected $name = \'command:name\';', $contents); } diff --git a/user_guide_src/source/cli/cli_generators.rst b/user_guide_src/source/cli/cli_generators.rst index 8636901644f2..e04772f6ab00 100644 --- a/user_guide_src/source/cli/cli_generators.rst +++ b/user_guide_src/source/cli/cli_generators.rst @@ -86,7 +86,7 @@ Argument: Options: ======== * ``--command``: The command name to run in spark. Defaults to ``command:name``. -* ``--group``: The group/namespace of the command. Defaults to ``CodeIgniter`` for basic commands, and ``Generators`` for generator commands. +* ``--group``: The group/namespace of the command. Defaults to ``App`` for basic commands, and ``Generators`` for generator commands. * ``--type``: The type of command, whether a ``basic`` command or a ``generator`` command. Defaults to ``basic``. * ``--namespace``: Set the root namespace. Defaults to value of ``APP_NAMESPACE``. * ``--suffix``: Append the component suffix to the generated class name.