1# Usage: 2# -antigen-get-clone-dir "https://github.com/zsh-users/zsh-syntax-highlighting.git[|feature/branch]" 3# Returns: 4# $ANTIGEN_BUNDLES/zsh-users/zsh-syntax-highlighting[-feature-branch] 5-antigen-get-clone-dir () { 6 local bundle="$1" 7 local url="${bundle%|*}" 8 local branch match mbegin mend MATCH MBEGIN MEND 9 [[ "$bundle" =~ "\|" ]] && branch="${bundle#*|}" 10 11 # Takes a repo url and mangles it, giving the path that this url will be 12 # cloned to. Doesn't actually clone anything. 13 local clone_dir="$ANTIGEN_BUNDLES" 14 15 url=$(-antigen-bundle-short-name $url) 16 17 # Suffix with branch/tag name 18 [[ -n "$branch" ]] && url="$url-${branch//\//-}" 19 url=${url//\*/x} 20 21 echo "$clone_dir/$url" 22} 23