XI62GRUV7UXWLGWBMPSDNMOTPPYPSP4XITW5UPT7PQLKW7V27K4AC VR6IOKCA2J3I7OZDAD6LE43KBTPFBKII7SIYMWTFPAP2R4MPHTNAC RXCY7LD6ZRIOIKZEYKLMCYPMQPXF4DOEEFBDLVR2B22BXLZJFFBQC A3TVGLVHSVLMEHLHB3TPBSD3QGNVGX3DIK6BEBDTTHWBNW4ALMRAC C4V5BR2KX2KLWSK4IH4CLSEUSJLVK6FDWM7Y43ZKGMI2BFNN3JEQC TGD23KBV2V7J7FFX7FDBENYMGDIOMS2JNOIZAYNXGQ52E4CQNJYAC MVGZ575CHTEYOYZJ22DZDSVSYWHW7U3BFUKSQIPDDQYWVASSUQLQC DWJHLZWVL7RM2WQXN3ZJTJXXKUEUNQLL37TMMTPL7NL375M2QJCQC 6EQI7R3C5QAA3R4J2VMRSJDYAALLVAHSGLATPKCZ7C4YY5MOGWKAC 3CY6DZO4DKCQ2BPIA7R6K4GQ52QKMSLNIWURG5CRC7BBHEGR7V3QC GIT_3DP_DIR="${GIT_3DP_DIR:-"$HOME/git_repos/3dp"}"typeset -g -A FORGE_ALIASESalias_usage="alias_forge <alias> <forge>"function alias_forge() {local alias=${1:?the first parameter to alias_forge should be the alias you want to set}local forge=${2:?the first parameter to alias_forge should be the forge the alias points to}if (( $# > 2 )); thenprintf "%s" "$alias_usage"elseFORGE_ALIASES[$alias]=$forgefi}alias_forge gh githubalias_forge gl gitlabGITHUB_USE_SSH=${GIT_USE_SSH:-${GITHUB_USE_SSH:-yes}}function github_url() {local git_spec="$package"if [[ -n "$git_user" ]]; thengit_spec="$git_user/$package"fiif [[ "$GITHUB_USE_SSH" == "yes" ]]; thenprintf "git@github.com:%s.git" "$git_spec"elseprintf "https://github.com/%s.git" "$git_spec"fi}GITLAB_USE_SSH=${GIT_USE_SSH:-${GITLAB_USE_SSH:-yes}}function gitlab_url() {local git_spec="$package"if [[ -n "$git_user" ]]; thengit_spec="$git_user/$package"fiif [[ "$GITLAB_USE_SSH" == "yes" ]]; thenprintf "git@gitlab.com:%s.git" "$git_spec"elseprintf "https://gitlab.com/%s.git" "$git_spec"fi}function git-forge-clone() {if [[ ! -e "$(basename "$package")" ]]; thengit clone "$($1)"elseecho "package already cloned"fi}function get_forge_function() {local forge="$1"local aliased_forge="${forge_aliases[$1]}"if [[ ! -z "$aliased_forge" ]]; thenforge="$aliased_forge"fiecho "${forge}_url"}function git-get() {local git_userlocal packageforge=${1?Need a forge spec}shiftif [[ $# == 1 ]]; thengit_user=package=$1elif (( $# == 2 )); thengit_user=$1package=$2shiftelseecho 'usage: <forge> <user> <package> or <forge> <package>'return 2fipackage=${package%.git}shiftcd "$GIT_3DP_DIR"local forge_url_function="${$(get_forge_function "$forge"):?forge not recognized}"git-forge-clone "$forge_url_function"cd "$(basename "$package")"}
if is-function "$POSSIBLE_CMD"; then$POSSIBLE_CMD "${@[2,-1]}"
possible_cmd="${${$(expand-alias "git-$1")#'}%'}"printf "%s" "$possible_cmd" | read -A cmdletsif [[ "$GIT_DEBUG" != "0" ]]; thenecho "git: looking for: \"$possible_cmd\" command: \"${cmdlets[1]}\""fiif is-function "${cmdlets[1]}"; then"${cmdlets[@]}" "${@[2,-1]}"
GIT_3DP_DIR="${GIT_3DP_DIR:-"$HOME/git_repos/3dp"}"typeset -g -A FORGE_ALIASESalias_usage="alias_forge <alias> <forge>"function alias_forge() {local alias=${1:?the first parameter to alias_forge should be the alias you want to set}local forge=${2:?the first parameter to alias_forge should be the forge the alias points to}if (( $# > 2 )); thenprintf "%s" "$alias_usage"elseFORGE_ALIASES[$alias]=$forgefi}alias_forge gh githubalias_forge gl gitlabGITHUB_USE_SSH=${GIT_USE_SSH:-${GITHUB_USE_SSH:-yes}}function github_url() {local git_spec="$package"if [[ -n "$git_user" ]]; thengit_spec="$git_user/$package"fiif [[ "$GITHUB_USE_SSH" == "yes" ]]; thenprintf "git@github.com:%s.git" "$git_spec"elseprintf "https://github.com/%s.git" "$git_spec"fi}GITLAB_USE_SSH=${GIT_USE_SSH:-${GITLAB_USE_SSH:-yes}}function gitlab_url() {local git_spec="$package"if [[ -n "$git_user" ]]; thengit_spec="$git_user/$package"fiif [[ "$GITLAB_USE_SSH" == "yes" ]]; thenprintf "git@gitlab.com:%s.git" "$git_spec"elseprintf "https://gitlab.com/%s.git" "$git_spec"fi}function git-forge-clone() {if [[ ! -e "$(basename "$package")" ]]; thengit clone "$($1)"elseecho "package already cloned"fi}function get_forge_function() {local forge="$1"local aliased_forge="${forge_aliases[$1]}"if [[ ! -z "$aliased_forge" ]]; thenforge="$aliased_forge"fiecho "${forge}_url"}function git-get() {local git_userlocal packageforge=${1?Need a forge spec}shiftif [[ $# == 1 ]]; thengit_user=package=$1elif (( $# == 2 )); thengit_user=$1package=$2shiftelseecho 'usage: <forge> <user> <package> or <forge> <package>'return 2fipackage=${package%.git}shiftcd "$GIT_3DP_DIR"local forge_url_function="${$(get_forge_function "$forge"):?forge not recognized}"git-forge-clone "$forge_url_function"cd "$(basename "$package")"}