gkmngrgn / dosh-core

Shell-independent task manager.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How could we rewrite this bash code in dosh?

gkmngrgn opened this issue · comments

for repo in $(curl -X GET "https://gitea.server/api/v1/repos/search?uid=goedev&limit=10000" \
                   -H "accept: application/json" \
                   -H "Authorization: token very-very-secret-token" \
                   -H "Content-Type: application/json" \
                   -s | jq -c ".data[] | {ssh_url,name}"); do
    ssh_url=$(echo $repo | jq -r ".ssh_url")
    name=$(echo $repo | jq -r ".name")
    repo_dir="$HOME/Workspace/goedev/$name"

    if [ -d $repo_dir ]; then
        echo "Repo $name is syncing..."
        git -C $repo_dir pull
    else
        echo "Repo $name is cloning..."
        git clone $ssh_url $repo_dir
    fi
    echo ""
done