script maintenance

This commit is contained in:
Matt Troutman 2024-10-03 00:38:34 -05:00
parent d6aa9cf4c8
commit 339cd33dd6
No known key found for this signature in database
3 changed files with 7 additions and 3 deletions

View file

@ -228,6 +228,8 @@ def remove_spaces_in_dir_names(root_path=font_location):
if ' ' in dir:
new_dir = dir.replace(' ', '-')
#lowercase the new directory name
while new_dir.endswith('-'):
new_dir = new_dir[:-1]
new_dir = new_dir.lower()
new_dir_path = os.path.join(root, new_dir)
os.rename(dir_path, new_dir_path)

View file

@ -2,9 +2,10 @@ import font_folder_cleanup
import os
def git_cleanup():
os.system("cd $(git rev-parse --show-toplevel)")
os.system("git reset --hard")
os.system("git clean -fdx -e .env/ -e .idea/ -e .fontfoldercleanup/")
os.system("cd $(git rev-parse --show-toplevel) && git stash push -- .fontfoldercleanup/ && git reset --hard && git clean -fdx -e .env/ -e .idea/ -e .fontfoldercleanup/")
def apply_stash():
os.system("cd $(git rev-parse --show-toplevel) && git stash apply")
if __name__ == '__main__':
# Clean up git repository
@ -13,3 +14,4 @@ if __name__ == '__main__':
font_folder_cleanup.remove_setup_complete_files() # Remove setup complete files from the repository
font_folder_cleanup.remove_empty_folders() # Remove empty folders from the repository
git_cleanup() # Clean up git repository again after removing files and folders
apply_stash() # Apply the stash to restore the files that were removed