Fix truncation warning

This commit is contained in:
Brendan Haines 2024-12-08 13:24:46 -07:00
parent da2c453430
commit 8c1e9751af

View File

@ -98,13 +98,12 @@ def wrap(command: List[str], config: Path, retries: int, version: bool, dry_run:
MAX_LINES = 20 MAX_LINES = 20
lines = stdout.splitlines() lines = stdout.splitlines()
truncated = False
if len(lines) > MAX_LINES: if len(lines) > MAX_LINES:
truncated = True
lines = lines[-MAX_LINES:] lines = lines[-MAX_LINES:]
message = ( message = (
"Command:\n" "Command:\n" + " ".join(command) + f'\n\nResult{ " (truncated)" if truncated else ""}:\n' + "\n".join(lines)
+ " ".join(command)
+ f'\n\nResult{ " (truncated)" if len(lines) > MAX_LINES else ""}:\n'
+ "\n".join(lines)
) )
if not dry_run: if not dry_run: