#!/usr/bin/python3
# SPDX-License-Identifier: GPL-3.0-only
# Copyright (C) 2026 Kangyao Huang
"""Keep generated UTF-8 help text readable without forced text justification."""
from pathlib import Path
import sys
for value in sys.argv[1:]:
    path = Path(value)
    lines = path.read_text(encoding='utf-8').splitlines(keepends=True)
    title = next(i for i, line in enumerate(lines) if line.startswith('.TH '))
    lines[title + 1:title + 1] = ['.nh\n', '.ad l\n']
    path.write_text(''.join(lines), encoding='utf-8')
