diff options
-rw-r--r-- | Readme.md | 2 | ||||
-rwxr-xr-x | github_sync.sh | 13 |
2 files changed, 15 insertions, 0 deletions
@@ -44,6 +44,8 @@ The first argument specifies the configuration file, setting the following varia REPO_DIR local repository directory PRIVATE Specifies, whether $REPO_DIR should be trated as public (false) or private (true) Repos will be created on GitHub accordingly + LIMIT Limit syncing to repos specified in LIMIT_TO (true/false) + LIMIT_TO Array of repos to limit syncing to ## License 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 |