This repository has been archived on 2021-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
gardening/scripts/clone.py

23 lines
558 B
Python
Executable File

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