Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .jules/palette.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@
## 2024-03-22 - CLI Interactive Fallbacks
**Learning:** CLI tools often fail hard when config is missing, but interactive contexts allow for graceful recovery. Users appreciate being asked for missing info instead of just receiving an error.
**Action:** When `sys.stdin.isatty()` is true, prompt for missing configuration instead of exiting with an error code.

## 2025-05-24 - CLI Hyperlinks & Alignment
**Learning:** Adding ANSI escape codes (like hyperlinks) to CLI tables breaks standard column alignment because the string length increases invisibly.
**Action:** When adding hyperlinks to table cells, manually calculate padding based on the visible text length, not the full string length.
14 changes: 13 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@
BOLD = ''
UNDERLINE = ''

@staticmethod
def link(text: str, url: str) -> str:

Check warning

Code scanning / Pylint (reported by Codacy)

Missing method docstring Warning

Missing method docstring

Check warning

Code scanning / Pylintpython3 (reported by Codacy)

Missing function or method docstring Warning

Missing function or method docstring
if not USE_COLORS:
return text
return f"\033]8;;{url}\033\\{text}\033]8;;\033\\"

class ColoredFormatter(logging.Formatter):
"""Custom formatter to add colors to log levels."""
LEVEL_COLORS = {
Expand Down Expand Up @@ -844,8 +850,14 @@
# Use boolean success field for color logic
status_color = Colors.GREEN if res['success'] else Colors.FAIL

# Create clickable profile ID
pid = res['profile']
# Pad manually because ANSI codes confuse f-string alignment
padding = " " * (profile_col_width - len(pid))
linked_pid = Colors.link(pid, f"https://controld.com/profiles/{pid}")

print(
f"{res['profile']:<{profile_col_width}} | "
f"{linked_pid}{padding} | "
f"{res['folders']:>10} | "
f"{res['rules']:>10,} | "
f"{res['duration']:>9.1f}s | "
Expand Down
Loading