import pathlib,textwrap,subprocess
root=pathlib.Path(__file__).parent
run=sorted(p for p in root.iterdir() if p.is_dir())[-1]
for side in ['before','after']:
 text=(run/f'{side}.txt').read_text()
 wrapped='\n'.join('\n'.join(textwrap.wrap(line,100,replace_whitespace=False,drop_whitespace=False)) if line else '' for line in text.splitlines())
 (run/f'{side}-display.txt').write_text(wrapped)
 subprocess.run(['convert','-size','1460x600','xc:#101820','-font','DejaVu-Sans-Mono','-pointsize','22','-fill','#e8edf2','-gravity','NorthWest','-annotate','+30+30',wrapped,str(run/f'{side}.png')],check=True)
print(run)
