diff --git a/docs/module/cli.md b/docs/module/cli.md index c80a736..a3933c3 100644 --- a/docs/module/cli.md +++ b/docs/module/cli.md @@ -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: diff --git a/src/fastapi_toolsets/cli/commands/fixtures.py b/src/fastapi_toolsets/cli/commands/fixtures.py index c479a9b..da4e3b1 100644 --- a/src/fastapi_toolsets/cli/commands/fixtures.py +++ b/src/fastapi_toolsets/cli/commands/fixtures.py @@ -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,