feat: allow default context via FIXTURES_CONTEXT env var for fixtures load (#343)

This commit is contained in:
d3vyce
2026-07-06 18:17:07 +02:00
committed by GitHub
parent 06d49d5dc4
commit 040c023b8a
2 changed files with 15 additions and 1 deletions
+14
View File
@@ -68,6 +68,20 @@ manager fixtures --help
╰──────────────────────────────────────────────────────────────────────────────────╯
```
### `fixtures load`
```bash
manager fixtures load [CONTEXTS]... [--strategy merge|insert|skip_existing] [--dry-run]
```
`CONTEXTS` defaults to `Context.BASE` when omitted, and can also be set via the `FIXTURES_CONTEXT` environment variable, handy for CI/deploy scripts that shouldn't need an explicit argument per environment:
```bash
FIXTURES_CONTEXT=testing manager fixtures load
```
An explicit CLI argument always takes precedence over the environment variable.
## Custom CLI
You can extend the CLI by providing your own Typer app. The `manager` entry point will merge your app's commands with the built-in ones:
@@ -57,7 +57,7 @@ async def load(
ctx: typer.Context,
contexts: Annotated[
list[str] | None,
typer.Argument(help="Contexts to load."),
typer.Argument(help="Contexts to load.", envvar="FIXTURES_CONTEXT"),
] = None,
strategy: Annotated[
LoadStrategy,