Skip to content

Add --html flag for email-friendly HTML table output#29

Merged
dimalvovs merged 3 commits into
mainfrom
copilot/beautify-report-output-for-email
May 8, 2026
Merged

Add --html flag for email-friendly HTML table output#29
dimalvovs merged 3 commits into
mainfrom
copilot/beautify-report-output-for-email

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 8, 2026

Plain-text column alignment in the report output breaks in proportional-font email clients. Adding --html renders the same data as inline-CSS HTML tables that look correct in any email client.

New functions

  • _collect_meta_keys(entries) — ordered union of metadata field names across all entries (required fields first)
  • _entry_to_html_row(...) — single directory entry → <tr>, all values passed through html.escape()
  • _print_html_entries(entries) — full <table> with adaptive columns (Groups, Files, Total Size omitted when absent) plus any metadata columns
  • _print_html_report(report_data)--report summary as two tables: per-track counts and per-user on-track shares with a total-average footer row

Wiring

  • main() gains html_output: bool = False; selects HTML renderers over plain-text ones when set. --output (YAML to file) takes precedence when both flags are given.
  • cli() gains --html argument.

Usage

# Directory listing
python3 ontrack.py --config ontrack.config --html

# On-track summary
python3 ontrack.py --config ontrack.config --report --html

# Pipe to mailer
python3 ontrack.py --config ontrack.config --html \
  | mail -a "Content-Type: text/html" -s "ontrack report" team@lab.org

No new dependencies — uses stdlib html.escape() throughout.

Copilot AI and others added 3 commits May 8, 2026 19:59
…aping check, document capitalize() behaviour

Agent-Logs-Url: https://github.com/FertigLab/ontrack/sessions/681c0cc2-9919-46f5-ac21-91ae05b69f37

Co-authored-by: dimalvovs <1246862+dimalvovs@users.noreply.github.com>
@dimalvovs dimalvovs marked this pull request as ready for review May 8, 2026 21:39
@dimalvovs dimalvovs merged commit 5270931 into main May 8, 2026
2 checks passed
@dimalvovs dimalvovs deleted the copilot/beautify-report-output-for-email branch May 8, 2026 21:39
Copilot stopped work on behalf of dimalvovs due to an error May 8, 2026 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants