GenerationContext
Everything a generator needs: the target plugin, the artifact name, CLI options, and repo root.
GenerationContext::__construct()
public function __construct(string $plugin, string $name, array $options, string $root):Parameters
| Name | Type | Description |
|---|---|---|
| $plugin | string | |
| $name | string | |
| $options | array<string, mixed> | |
| $root | string |
GenerationContext::option()
public function option(string $key): ?stringReads a CLI `--option` value; `null` when absent or not a string.
Parameters
| Name | Type | Description |
|---|---|---|
| $key | string |
GenerationContext::flag()
public function flag(string $key): boolReads a boolean-ish CLI `--flag` (e.g. `--force`, used to re-run a {@see \Milpa\DevTools\Make\MarkerInserter} insertion that already landed once): a native `bool` is returned as-is, a string is truthy unless it is `''`, `'0'`, or `'false'` (case-insensitive) — mirrors {@see \Milpa\DevTools\Make\Generators\ServiceGenerator}'s pre-existing `--interface` parsing exactly. Absent or any other type reads as `false`.
Parameters
| Name | Type | Description |
|---|---|---|
| $key | string |