Skip to content

Commit 9fd5a15

Browse files
refactor: Rename in_duration parameter to stop_in for consistency (#33)
The stop() function used parameter name 'in_duration' while the start() function used 'stop_in' for the same purpose (scheduling automatic shutdown). This inconsistency created cognitive overhead. Renamed the parameter to 'stop_in' to match the pattern used in start(). The CLI flag '--in' remains unchanged for backwards compatibility. Co-authored-by: Claude <noreply@anthropic.com> (cherry picked from commit 5e34587)
1 parent d609bd2 commit 9fd5a15

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

progress.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,3 +167,20 @@ This is similar to the `ec2_client` shim that was removed from `utils.py` in a p
167167
**Changes:**
168168
- Removed the unused `ENV_PREFIX = "REMOTE_"` constant
169169
- Removed the associated comment "Environment variable mapping for config values"
170+
171+
---
172+
173+
## 2026-01-18: Rename `in_duration` parameter to `stop_in` for consistency
174+
175+
**File:** `remote/instance.py`
176+
177+
**Issue:** The `stop()` function used parameter name `in_duration` while the `start()` function used `stop_in` for the same purpose (scheduling automatic shutdown). This inconsistency created cognitive overhead when working with both functions:
178+
- `start()` (line 375): parameter `stop_in` with CLI flag `--stop-in`
179+
- `stop()` (line 601): parameter `in_duration` with CLI flag `--in`
180+
181+
Both parameters serve the same purpose: specifying a duration after which the instance should be stopped.
182+
183+
**Changes:**
184+
- Renamed `in_duration` to `stop_in` in the `stop()` function signature (line 601)
185+
- Updated all references to `in_duration` within the function body (lines 641, 649)
186+
- The CLI flag `--in` remains unchanged for backwards compatibility

remote/instance.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ def _cancel_scheduled_shutdown(instance_name: str, instance_id: str) -> None:
598598
@app.command()
599599
def stop(
600600
instance_name: str | None = typer.Argument(None, help="Instance name"),
601-
in_duration: str | None = typer.Option(
601+
stop_in: str | None = typer.Option(
602602
None,
603603
"--in",
604604
help="Schedule stop after duration (e.g., 3h, 30m, 1h30m). Uses SSH to run 'shutdown -h'.",
@@ -638,15 +638,15 @@ def stop(
638638
return
639639

640640
# Handle scheduled shutdown
641-
if in_duration:
641+
if stop_in:
642642
if not is_instance_running(instance_id):
643643
typer.secho(
644644
f"Instance {instance_name} is not running - cannot schedule shutdown",
645645
fg=typer.colors.YELLOW,
646646
)
647647
return
648648
try:
649-
minutes = parse_duration_to_minutes(in_duration)
649+
minutes = parse_duration_to_minutes(stop_in)
650650
_schedule_shutdown(instance_name, instance_id, minutes)
651651
except ValidationError as e:
652652
typer.secho(f"Error: {e}", fg=typer.colors.RED)

0 commit comments

Comments
 (0)