File tree Expand file tree Collapse file tree
user_guide_src/source/cli Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -308,3 +308,16 @@ GeneratorTrait
308308
309309All generator commands must use the ``GeneratorTrait `` to fully utilize its methods that are used in code
310310generation.
311+
312+ *************************************************************
313+ Declaring the Location of a Custom Generator Command Template
314+ *************************************************************
315+
316+ The default order of lookup for generator templates is (1) the template defined in the **app/Config/Generators.php ** file,
317+ and (2) if not found, the template found at the ``CodeIgniter\Commands\Generators\Views `` namespace.
318+
319+ To declare the template location for your custom generator command, you will need to add it to the **app/Config/Generators.php **
320+ file. For example, if you have a command ``make:awesome-command `` and your generator template is located within your *app *
321+ directory **app/Commands/Generators/Views/awesomecommand.tpl.php **, you would update the config file like so:
322+
323+ .. literalinclude :: cli_generators/001.php
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Config ;
4+
5+ use CodeIgniter \Config \BaseConfig ;
6+
7+ class Generators extends BaseConfig
8+ {
9+ public array $ views = [
10+ // ..
11+ 'make:awesome-command ' => 'App\Commands\Generators\Views\awesomecommand.tpl.php ' ,
12+ ];
13+ }
You can’t perform that action at this time.
0 commit comments