import font_folder_cleanup
import os

def git_cleanup():
    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
    git_cleanup() # Clean up git repository
    font_folder_cleanup.remove_ds_store_files()  # Remove .DS_Store files from the repository
    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