[READ-ONLY] Mirror of https://github.com/mrgnw/scripts.
1from pathlib import Path
2from git import Repo
3from concurrent.futures import ThreadPoolExecutor
4from tqdm import tqdm
5
6def update_repo(repo_path):
7 repo = Repo(repo_path)
8 repo.remotes.origin.pull()
9
10def main():
11 repo_folder = Path().cwd()
12 repos = [repo_path for repo_path in repo_folder.iterdir() if repo_path.is_dir()]
13
14 with ThreadPoolExecutor() as executor:
15 futures = [executor.submit(update_repo, repo) for repo in repos]
16
17 with tqdm(total=len(futures), ncols=80, desc="Updating repositories") as pbar:
18 for future in futures:
19 future.result()
20 pbar.update(1)
21
22if __name__ == '__main__':
23 main()