Skip to content

Commit b29adc5

Browse files
Kasper JungeRalphify
authored andcommitted
refactor: use _plural() helper consistently for pluralization
Three places in _console_emitter.py manually inlined the "count word{'s' if count != 1 else ''}" pattern instead of calling the existing _plural() helper. This replaces them all with _plural() calls for consistency and DRY. Co-authored-by: Ralphify <noreply@ralphify.co>
1 parent 1dc8c3b commit b29adc5

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/ralphify/_console_emitter.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ def _build_footer(self) -> Table:
476476
summary = Text(no_wrap=True, overflow="ellipsis")
477477
if self._tool_count > 0:
478478
summary.append(
479-
f"{self._tool_count} tool{'s' if self._tool_count != 1 else ''}",
479+
_plural(self._tool_count, "tool"),
480480
style=f"bold {_brand.PURPLE}",
481481
)
482482
cats = self._format_categories()
@@ -596,7 +596,7 @@ def scroll_to_bottom(self) -> None:
596596
def _build_header(self, total: int, visible: int) -> Text:
597597
header = Text(no_wrap=True, overflow="ellipsis")
598598
header.append(" Full peek ", style=f"bold {_brand.PURPLE}")
599-
header.append(f"· {total} line{'s' if total != 1 else ''}", style="dim")
599+
header.append(f"· {_plural(total, 'line')}", style="dim")
600600
if self._auto_scroll:
601601
header.append(" · ", style="dim")
602602
header.append("following", style=f"italic {_brand.GREEN}")
@@ -1180,7 +1180,7 @@ def _build_footer(self) -> Table:
11801180
summary = Text(no_wrap=True, overflow="ellipsis")
11811181
if line_count > 0:
11821182
summary.append(
1183-
f"{line_count} line{'s' if line_count != 1 else ''}",
1183+
_plural(line_count, "line"),
11841184
style=f"bold {_brand.PURPLE}",
11851185
)
11861186
summary.append(" of agent output", style="dim")

0 commit comments

Comments
 (0)