diff --git a/api b/api index 652f60d862..9ee77ca1fa 100755 --- a/api +++ b/api @@ -3039,16 +3039,19 @@ Please reboot to load the new kernel, then try again." git_clone() { #silently clone a git repository but display the output if an error occurs # $1 is repo local IFS=' ' + local arg + local repo_name='' for arg in "$@"; do if [[ "$arg" == *'://'* ]];then - url="$arg" + local url="$arg" + repo_name=$(basename "$url" | sed s/.git//g) + elif [ ! -z "$repo_name" ] && [[ "$arg" != -* ]];then #repo_name already set, so this arg is after the url to specify the download folder name + repo_name="$arg" fi done [ -z "$url" ] && error "git_clone(): no repository URL specified." - local repo_name=$(basename "$url" | sed s/.git//g) - local folder="$(pwd)/$repo_name" status -n "Downloading $repo_name repository... "