diff options
author | Jonas Gunz <himself@jonasgunz.de> | 2021-02-08 11:58:30 +0100 |
---|---|---|
committer | Jonas Gunz <himself@jonasgunz.de> | 2021-02-08 11:58:30 +0100 |
commit | 4f5579b634f2a459d1a2fa8bdebc668928a8e501 (patch) | |
tree | 24774be13fa3299c1f310a6589dd8135ad4a128a /github_sync.sh | |
parent | 3c9c2f8a8e46b1c119511e21ec187a197c4b75df (diff) | |
download | reposync-4f5579b634f2a459d1a2fa8bdebc668928a8e501.tar.gz |
add LIMIT and LIMIT_TO to limit repo syncing to specific repos
Diffstat (limited to 'github_sync.sh')
-rwxr-xr-x | github_sync.sh | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/github_sync.sh b/github_sync.sh index f33374f..61bdd45 100755 --- a/github_sync.sh +++ b/github_sync.sh @@ -15,6 +15,8 @@ # TOKEN Password or Token # REPO_DIR Directory on the filesystem # PRIVATE Treat repositories as private (true/false) +# LIMIT Limit syncing to repos specified in LIMIT_TO (true/false) +# LIMIT_TO Array of repos to limit syncing to ARGV=($@) ARGC=${#ARGV[@]} @@ -100,6 +102,17 @@ TO_CREATE=( $(comm -13 <(printf "%s\n" "${!GH_REPOS[@]}" | sort) \ TO_PUSH=( $(comm -12 <(printf "%s\n" "${!GH_REPOS[@]}" | sort) \ <(printf "%s\n" "${LOCAL_REPOS[@]}" | sort) ) ) +if [ "$LIMIT" = "true" -a "${#LIMIT_TO[@]}" -gt 0 ]; then + TO_CLONE=( $(comm -12 <(printf "%s\n" "${LIMIT_TO[@]}" | sort) \ + <(printf "%s\n" "${TO_CLONE[@]}" | sort) ) ) + + TO_CREATE=( $(comm -12 <(printf "%s\n" "${LIMIT_TO[@]}" | sort) \ + <(printf "%s\n" "${TO_CREATE[@]}" | sort) ) ) + + TO_PUSH=( $(comm -12 <(printf "%s\n" "${LIMIT_TO[@]}" | sort) \ + <(printf "%s\n" "${TO_PUSH[@]}" | sort) ) ) +fi + echo TO CLONE printf "%s\n" "${TO_CLONE[@]}" echo |