Merge pull request #463 from Ammar64/master

Make it work for older python versions
This commit is contained in:
offa
2024-11-07 18:03:00 +00:00
committed by GitHub
2 changed files with 5 additions and 3 deletions
+2
View File
@@ -30,6 +30,8 @@ jobs:
contents: read
name: Ensure sorted
steps:
- name: Checkout
uses: actions/checkout@main
- name: Ensure sorted
run: python3 ensure_sorted.py
+2 -2
View File
@@ -74,7 +74,7 @@ def main():
categories.append(category)
# This is also a category
elif lines[i].startswith("## "):
category_name = re.findall("(?<=##\s\s).*?(?=\s)", lines[i])[0]
category_name = re.findall("(?<=##\\s\\s).*?(?=\\s)", lines[i])[0]
category = Category(category_name)
categories.append(category)
# This is an app
@@ -93,7 +93,7 @@ def main():
longest_str = len(max(unsorted, key=len))
for j in range(len(sorted)):
color = sorted[j] != unsorted[j]
print(f' {bcolors.RED if color else ''}{unsorted[j]}{bcolors.ENDC if color else ''}{((longest_str-len(unsorted[j]))+2) * ' '}{bcolors.GREEN if color else ''}{sorted[j]}{bcolors.ENDC if color else ''}')
print(f' {bcolors.RED if color else ""}{unsorted[j]}{bcolors.ENDC if color else ""}{((longest_str-len(unsorted[j]))+2) * " "}{bcolors.GREEN if color else ""}{sorted[j]}{bcolors.ENDC if color else ""}')
all_sorted = False
if not all_sorted: