Skip to content

Commit 3fa247d

Browse files
committed
🩹 fix-simple(duties.py): add action parameter to _pick_env to distinguish between build, start and stop when dealing with Docker containers
1 parent 19c75f5 commit 3fa247d

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎template/duties.py.jinja‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ def _verify_uv_installed(ctx: Context, duty_name: str) -> None:
5959
){% if dockerfile %}
6060

6161

62-
def _pick_env(ctx: Context, env: str = "dev") -> str:
62+
def _pick_env(ctx: Context, env: str = "dev", action: str = "start") -> str:
6363
while True:
6464
ctx.run(
6565
"true",
66-
title="Pick the environment you want to start ([dev]/prod): ",
66+
title=f"Pick the environment you want to {action} ([dev]/prod): ",
6767
nofail=True,
6868
allow_overrides=False,
6969
)
@@ -253,7 +253,7 @@ def docker_build(ctx: Context, env: str | None = None) -> None:
253253
Args:
254254
env: The environment to build for (`dev` or `prod`). Defaults to `None` to prompt the user.
255255
"""
256-
env = env or _pick_env(ctx)
256+
env = env or _pick_env(ctx, action="build")
257257
ctx.run(
258258
["docker", "compose", "--profile", env, "build"],
259259
title=f"Building Docker images for {env} environment",
@@ -307,7 +307,7 @@ def docker_stop(ctx: Context, env: str | None = None) -> None:
307307
Args:
308308
env: The environment to stop (`dev` or `prod`). Defaults to `None` to prompt the user.
309309
"""
310-
env = env or _pick_env(ctx)
310+
env = env or _pick_env(ctx, action="stop")
311311
ctx.run(
312312
["docker", "compose", "--profile", env, "down"],
313313
title=f"Stopping and removing {env} containers",

0 commit comments

Comments
 (0)