Sort repeat_read's imports and keep its sed range's names apart

This commit is contained in:
2026-10-28 12:44:18 +01:00
parent 2d3ec3a636
commit 1d2f3d14d2
3 changed files with 6 additions and 6 deletions
+4 -4
View File
@@ -5,9 +5,9 @@ Lines are in context when earlier reads' results show each of them, as the file
import dataclasses
import re
from claude_code.entries import parse_entry, part_text, parts
from rule_hook.call import Call, text
from rule_hook.rules import Breach
from rule_hook.call import Call, text
from claude_code.entries import parse_entry, part_text, parts
from shell_command import resolved, simple_commands
# The lines a Read without a limit returns.
@@ -57,8 +57,8 @@ def asked_lines(tool: object, given: object, cwd: str, home: str) -> Asked | Non
if name == "head" and (counted := HEAD_COUNT.fullmatch(" ".join(options) or "-10")):
return Asked(path, 1, int(counted.group(1)))
if name == "sed" and len(options) == 2 and options[0] == "-n" and (ranged := SED_RANGE.fullmatch(options[1])):
first, last = ranged.groups()
return Asked(path, int(first), None if last == "$" else int(last or first))
start, end = ranged.groups()
return Asked(path, int(start), None if end == "$" else int(end or start))
return None