From 221d1b3d35493c8ea971d0148c248ea687123c27 Mon Sep 17 00:00:00 2001 From: Clemens Schwaighofer Date: Fri, 4 Jul 2025 13:46:06 +0900 Subject: [PATCH] remote host auto set if not given --- src/bin/new_clone.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/bin/new_clone.sh b/src/bin/new_clone.sh index 6fc847f..0845996 100755 --- a/src/bin/new_clone.sh +++ b/src/bin/new_clone.sh @@ -19,9 +19,14 @@ if [ -z "${REPOSITORY}" ]; then echo "[!] Must set a repository path"; error=1; fi; +# if remote host is empty try to set from repository if [ -z "${REMOTE_HOST}" ]; then - echo "[!] Must set a remote host for the repository"; - error=1; + if [[ "${REPOSITORY}" == *":"* ]]; then + REMOTE_HOST=$(echo "${REPOSITORY}" | cut -d ":" -f 1); + else + echo "[!] Must set a remote host for the repository"; + error=1; + fi; fi; # if we have an ":" in the repository, split by it and replace it with the remote host if [[ "${REPOSITORY}" == *":"* ]]; then