Extract the remote URL from the repository URL
This commit is contained in:
parent
2074c748cb
commit
d26ecee2ee
1 changed files with 6 additions and 1 deletions
|
@ -23,12 +23,17 @@
|
||||||
[[ -z "$user" ]] && user="$USER"
|
[[ -z "$user" ]] && user="$USER"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Extract the remote domain (e.g. github.com) from the repo URL.
|
||||||
|
domain="''${repo_url#*@}"
|
||||||
|
domain="''${domain%:*}"
|
||||||
|
|
||||||
repo_name="''${user_and_repo_name##*/}"
|
repo_name="''${user_and_repo_name##*/}"
|
||||||
repo_name="''${repo_name%.git}"
|
repo_name="''${repo_name%.git}"
|
||||||
|
|
||||||
user_path="''${HOME}/Code/github.com/''${user}"
|
user_path="''${HOME}/Code/''${domain}/''${user}"
|
||||||
|
|
||||||
user_repo_path="''${user_path}/''${repo_name}"
|
user_repo_path="''${user_path}/''${repo_name}"
|
||||||
|
|
||||||
[[ -d "''${user_repo_path}" ]] && t "''${user_repo_path}" && return
|
[[ -d "''${user_repo_path}" ]] && t "''${user_repo_path}" && return
|
||||||
|
|
||||||
${pkgs.coreutils}/bin/mkdir -p "''${user_path}"
|
${pkgs.coreutils}/bin/mkdir -p "''${user_path}"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue