Answer architecture round 1: give the transcript archive one module that writes and reads it, anchor the finished line to its stamp, build Reads once, and record the scoring run
This commit is contained in:
+5
-4
@@ -20,15 +20,16 @@ class Reads:
|
||||
|
||||
|
||||
def shell_reads(command: str, cwd: str, home: str) -> Reads:
|
||||
reads = Reads([], [])
|
||||
read: list[str] = []
|
||||
added: list[str] = []
|
||||
base = cwd
|
||||
for tokens in shell_lines(command):
|
||||
for words in segments(tokens):
|
||||
if words[0] == "cd" and len(words) == 2:
|
||||
base = resolved(base, words[1], home)
|
||||
reads.read.extend(resolved(base, word, home) for word in operands(words))
|
||||
reads.added.extend(resolved(base, path, home) for path in worktree_added(words))
|
||||
return reads
|
||||
read += [resolved(base, word, home) for word in operands(words)]
|
||||
added += [resolved(base, path, home) for path in worktree_added(words)]
|
||||
return Reads(read, added)
|
||||
|
||||
|
||||
def shell_lines(command: str) -> typing.Iterator[list[str]]:
|
||||
|
||||
Reference in New Issue
Block a user