diff --git a/git-build.sh b/git-build.sh index bbeecc0..3881f34 100755 --- a/git-build.sh +++ b/git-build.sh @@ -36,8 +36,20 @@ PROJECTS=() for arg in "$@"; do if [[ "$arg" = "-f" ]] || [[ "$arg" = "--force" ]]; then FORCE=1 + # Maybe it's a task name and we find a corresponding source? elif [ -f $BASEDIR/$arg.source ]; then PROJECTS+=("$arg") + # Maybe it's a repo URL and we find a corresponding task? + elif matches="$(grep --files-with-matches --word-regexp "$arg" $BASEDIR/*.source)"; then + # Iterate over the files found to extract the task name + IFS= echo "$matches" | while read -r file; do + task_name="$(basename "$file" .source)" + # Make sure we don't have a .source file without name lying around, just in case + [[ "$task_name" != "" ]] && PROJECT+=("$task_name") + done + else + echo "ERROR: Unknown argument '$arg' (doesn't match a task name or source URL)" + exit 1 fi done