Skip to content

rexiftool: unify print format across sections#49

Merged
mindeng merged 2 commits into
mainfrom
rexiftool-print-format
May 10, 2026
Merged

rexiftool: unify print format across sections#49
mindeng merged 2 commits into
mainfrom
rexiftool-print-format

Conversation

@mindeng
Copy link
Copy Markdown
Owner

@mindeng mindeng commented May 10, 2026

Summary

Tightens up rexiftool's default (non-JSON) output so the three sections look like one tool rather than three.

  • Consistent section dividers. Every section header now uses the same 48-char -- Title -----... style. Previously Embedded Track had a long tail, Format Metadata had only --, and the dir-mode separator was a different width again.
  • Auto-sized key column. The key column was hardcoded to 32, which broke alignment whenever a MakerNote or Unknown(0xNNNN) tag exceeded that width. It now clamps to 32..=48 based on the widest key in the section.
  • -- EXIF -- header only when needed. Added so the main section is no longer asymmetric vs. Embedded/Format, but suppressed when no extra section follows — single-section files stay uncluttered.
  • Directory mode File: line now uses Path::display() instead of the debug-quoted OsStr, and the divider matches the new section width.

JSON output is untouched.

Test plan

  • cargo build -p rexiftool
  • cargo fmt --check
  • Spot-checked output on PNG with EXIF + tEXt (testdata/exif-both.png), motion photo with embedded MP4 (testdata/motion_photo_pixel_synth.jpg), plain JPEG (single section, no -- EXIF -- header), and directory mode.

mindeng added 2 commits May 10, 2026 22:43
- Section headers all share a 48-char `-- Title ---` style; show
  `-- EXIF --` only when an Embedded Track or Format Metadata
  section also follows, so single-section output stays uncluttered.
- Key column auto-sizes from the widest tag (clamped 32..=48) so
  long MakerNote/Unknown keys no longer break alignment.
- Directory mode prints `File: {path}` via `Path::display()` instead
  of the debug-quoted `OsStr`, and reuses the same divider width.
@mindeng mindeng merged commit 0fd122e into main May 10, 2026
2 checks passed
@mindeng mindeng deleted the rexiftool-print-format branch May 10, 2026 15:56
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.

1 participant