aboutsummaryrefslogtreecommitdiff
path: root/github_sync.sh
diff options
context:
space:
mode:
Diffstat (limited to 'github_sync.sh')
-rwxr-xr-xgithub_sync.sh13
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