From c35eeadd88cae7fc19e3f740736c7ae720825d92 Mon Sep 17 00:00:00 2001 From: TristanAncelet Date: Sat, 4 Sep 2021 16:13:56 -0500 Subject: [PATCH] working on my README update script --- Arch_Install/.update.py | 3 --- update.py | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 3 deletions(-) delete mode 100644 Arch_Install/.update.py create mode 100644 update.py diff --git a/Arch_Install/.update.py b/Arch_Install/.update.py deleted file mode 100644 index 0fd0c26..0000000 --- a/Arch_Install/.update.py +++ /dev/null @@ -1,3 +0,0 @@ -import os - -items_in_dir = os.listdir() diff --git a/update.py b/update.py new file mode 100644 index 0000000..89b69c3 --- /dev/null +++ b/update.py @@ -0,0 +1,37 @@ +import os +import re + +article_finder = re.compile(r'- \[\S+\]\((\S+)\)') + +def articles_in_readme(readme_path): + with open(readme_path, 'r', encoding="UTF-8") as file: + contents = article_finder.findall(file.read()) + file.close() + return contents + +def is_markdown_file(filename): + matcher = re.compile(f'\S+\.md') + return True if matcher.match(filename) else False + +def make_readme_article_name(filename): + word_finder = re.compile(r"_?([A-Z][a-z]+") + +def articles_in_directory(directory): + files = list() + for file in os.listdir(directory): + if is_markdown_file(file) and file := "README.md": + files.append(file) + + +def update_readme_contents(directory): + + + +def readme_matches_directory_contents(directory): + if articles_in_readme(os.path.join(directory, 'README.md')) == os.listdir() + + +for directory in os.listdir(): + if os.path.isdir(directory): + readme +