Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: change make:command default $group to App #8109

Merged
merged 1 commit into from
Oct 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions system/Commands/Generators/CommandGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.',
Expand Down Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions tests/system/Commands/CommandGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion user_guide_src/source/cli/cli_generators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading