This repository has been archived on 2020-11-04. You can view files and clone it, but cannot push or open issues or pull requests.
gardening/clone_all.py

20 lines
510 B
Python

#!/usr/bin/env python3
from os import mkdir
from os.path import exists
from pathlib import Path
from shlex import split
from subprocess import run
from requests import get
response = get("https://git.autonomic.zone/api/v1/orgs/coop-cloud/repos")
repos = [[p["name"], p["clone_url"]] for p in response.json()]
clones = Path("clones").absolute()
if not exists(clones):
mkdir(clones)
for name, url in repos:
try:
run(split(f"git clone {url} {clones}/{name}"))
except Exception:
pass