[M] Rename /merging to /tools

This commit is contained in:
Azalea (on HyDEV-Daisy) 2022-08-01 11:52:40 -04:00
parent 97cbdecb5e
commit 47c32f07d7
6 changed files with 1 additions and 0 deletions

21
tools/reformat_readme.py Normal file
View file

@ -0,0 +1,21 @@
#!/usr/bin/env python3
"""
This script turns readme shorthand pull request references (i.e. dylanaraps/neofetch#1946) into full
GitHub pull request links.
"""
import re
from pathlib import Path
RE_SHORTHAND = re.compile(r"""[a-z0-9]+?/[a-z0-9]+?#[0-9]+""")
if __name__ == '__main__':
readme = Path('README.md').read_text()
for shorthand in RE_SHORTHAND.findall(readme):
user, pull = shorthand.split('/')
repo, pull = pull.split('#')
readme = readme.replace(shorthand, f'[{user}#{pull}](https://github.com/{user}/{repo}/pull/{pull})')
Path('README.md').write_text(readme)