refactor: inline code formatting

This commit is contained in:
banteg
2025-12-29 02:55:17 +04:00
parent c752c9735d
commit d872e9caf2
@@ -26,10 +26,6 @@ def truncate(text: str, max_len: int) -> str:
return one_line(text)[:max_len] return one_line(text)[:max_len]
def inline_code(text: str) -> str:
return f"`{text}`"
def format_elapsed(elapsed_s: float) -> str: def format_elapsed(elapsed_s: float) -> str:
total = max(0, int(elapsed_s)) total = max(0, int(elapsed_s))
minutes, seconds = divmod(total, 60) minutes, seconds = divmod(total, 60)
@@ -52,7 +48,7 @@ def format_command(command: str) -> str:
command = truncate(command, MAX_CMD_LEN) command = truncate(command, MAX_CMD_LEN)
if not command: if not command:
command = "(empty)" command = "(empty)"
return inline_code(command) return f"`{command}`"
def format_query(query: str) -> str: def format_query(query: str) -> str:
@@ -62,7 +58,7 @@ def format_query(query: str) -> str:
def format_paths(paths: list[str]) -> str: def format_paths(paths: list[str]) -> str:
rendered = [] rendered = []
for path in paths: for path in paths:
rendered.append(inline_code(truncate(path, MAX_PATH_LEN))) rendered.append(f"`{truncate(path, MAX_PATH_LEN)}`")
return ", ".join(rendered) return ", ".join(rendered)