[+] Deploy tool: Automatically update help page and regenerate man

This commit is contained in:
Azalea (on HyDEV-Daisy) 2022-09-06 11:30:51 -04:00
parent 31f50d38ee
commit 92ae4b4316
No known key found for this signature in database
GPG key ID: E289FAC0DA92DD2B
3 changed files with 30 additions and 6 deletions

View file

@ -69,6 +69,25 @@ def edit_versions(version: str):
path.write_text('\n'.join(lines))
def finalize_neofetch():
"""
Finalize current version
"""
# 1. Update distro list
path = Path('neofetch')
content = path.read_text()
content = re.compile(r'(?<=# Flag: --ascii_distro\n#\n).*?(?=ascii_distro=)', re.DOTALL)\
.sub(generate_help(100, '# ') + '\n', content)
content = re.compile(r"""(?<=Which Distro's ascii art to print\n\n).*?{distro}_small to use them\.""", re.DOTALL)\
.sub(generate_help(100, ' ' * 32), content)
path.write_text(content)
# 2. Regenerate man page
Path('neofetch.1').write_text(subprocess.check_output(['help2man', './neofetch']).decode())
# 3. Reformat readme links
reformat_readme()
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='HyFetch Release Utility')
parser.add_argument('version', help='Version to release')
@ -77,4 +96,5 @@ if __name__ == '__main__':
pre_check()
edit_versions(args.version)
finalize_neofetch()