Factorize README generation into a function
This commit is contained in:
parent
b2d19fd022
commit
f6d0b63166
1 changed files with 33 additions and 28 deletions
|
@ -4,12 +4,8 @@ import os
|
|||
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
parser = argparse.ArgumentParser(description='Automatically (re)generate README for apps')
|
||||
parser.add_argument('app_path',
|
||||
help='Path to the app to generate/update READMEs for')
|
||||
|
||||
args = parser.parse_args()
|
||||
app_path = args.app_path
|
||||
def generate_READMEs(app_path):
|
||||
|
||||
if not os.path.exists(app_path):
|
||||
raise Exception("App path provided doesn't exists ?!")
|
||||
|
@ -41,3 +37,12 @@ for lang, lang_suffix in [("en", ""), ("fr", "_fr")]:
|
|||
out = template.render(lang=lang, upstream=upstream, screenshots=screenshots, disclaimer=disclaimer, manifest=manifest)
|
||||
with open(os.path.join(app_path, f"README{lang_suffix}.md"), "w") as f:
|
||||
f.write(out)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description='Automatically (re)generate README for apps')
|
||||
parser.add_argument('app_path',
|
||||
help='Path to the app to generate/update READMEs for')
|
||||
|
||||
args = parser.parse_args()
|
||||
generate_READMEs(args.app_path)
|
||||
|
|
Loading…
Reference in a new issue