From f73c297c0d99e425c37e9f674d5ea5e76e0b8211 Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Tue, 25 Mar 2025 01:00:07 -0400 Subject: [PATCH] AutoYADM commit: 2025-03-25 01:00:07 --- .config/mail/format.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.config/mail/format.py b/.config/mail/format.py index e69de29b..aacf24e1 100755 --- a/.config/mail/format.py +++ b/.config/mail/format.py @@ -0,0 +1,23 @@ +#!/bin/env python + +import textwrap +import sys + +with open(sys.argv[1], 'r') as f: + lines = f.read().splitlines() + + +skipping = False +for line in lines: + prefix = line.strip()[0] + match prefix: + case ">": + # ignore quoted line + print(line) + case "```": + # ignore code block + skipping = not skipping + case _: + # wrap the line + wrapped = textwrap.wrap(line, width=74, break_long_words=False, replace_whitespace=True) +