Skip to content

Commit

Permalink
Merge pull request #8109 from kenjis/fix-spark-make-command
Browse files Browse the repository at this point in the history
fix: change make:command default $group to `App`
  • Loading branch information
kenjis authored Oct 28, 2023
2 parents 243a6be + 42d77d6 commit b0d8fd8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
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

0 comments on commit b0d8fd8

Please sign in to comment.