@@ -10,6 +10,7 @@ SCM_GIT_CHAR_GITLAB=${BARBUK_GITLAB_CHAR:=' '}
1010SCM_GIT_CHAR_BITBUCKET=${BARBUK_BITBUCKET_CHAR:= ' ' }
1111SCM_GIT_CHAR_GITHUB=${BARBUK_GITHUB_CHAR:= ' ' }
1212SCM_GIT_CHAR_ARCHLINUX=${BARBUK_ARCHLINUX_CHAR:= ' ' }
13+ SCM_GIT_CHAR_CODEBERG=${BARBUK_CODEBERG_CHAR:= ' ' }
1314SCM_GIT_CHAR_DEFAULT=${BARBUK_GIT_DEFAULT_CHAR:= ' ' }
1415SCM_GIT_CHAR_ICON_BRANCH=${BARBUK_GIT_BRANCH_ICON:= ' ' }
1516SCM_HG_CHAR=${BARBUK_HG_CHAR:= ' ☿ ' }
@@ -64,18 +65,30 @@ RBENV_THEME_PROMPT_SUFFIX=''
6465RBFU_THEME_PROMPT_PREFIX=' '
6566RBFU_THEME_PROMPT_SUFFIX=' '
6667
68+ function __get_domain_from_git_remote() {
69+ local git_remote=" $1 "
70+ echo " $git_remote " | awk -F' [@:]' ' $1 ~ /ssh/ {domain=$3} $1 ~ /https/ {domain=$2} $1 ~ /git/ {domain=$2} { sub("//", "", domain); sub(/\/.*$/, "", domain); print domain }'
71+ }
72+
6773function __git-upstream-remote-logo_prompt() {
6874 [[ -z " $( _git-upstream) " ]] && SCM_GIT_CHAR=" ${SCM_GIT_CHAR_DEFAULT:- } "
6975
7076 local remote remote_domain
7177 remote=" $( _git-upstream-remote) "
72- remote_domain=$( git config --get remote." ${remote} " .url \
73- | awk -F' [@:]' ' $1 ~ /ssh/ {domain=$3} $1 ~ /https/ {domain=$2} $1 ~ /git/ {domain=$2} { sub("//", "", domain); sub(/\/.*$/, "", domain); print domain }' )
78+
79+ if [ -z " $remote " ]; then
80+ remote=$( git ls-remote --get-url 2> /dev/null)
81+ else
82+ remote=$( git config --get remote." ${remote} " .url)
83+ fi
84+
85+ remote_domain=$( __get_domain_from_git_remote " $remote " )
7486
7587 case " ${remote_domain} " in
7688 github.com) SCM_GIT_CHAR=" ${SCM_GIT_CHAR_GITHUB:- } " ;;
7789 gitlab.com) SCM_GIT_CHAR=" ${SCM_GIT_CHAR_GITLAB:- } " ;;
7890 bitbucket.com) SCM_GIT_CHAR=" ${SCM_GIT_CHAR_BITBUCKET:- } " ;;
91+ codeberg.org) SCM_GIT_CHAR=" ${SCM_GIT_CHAR_CODEBERG:- } " ;;
7992 aur.archlinux.org) SCM_GIT_CHAR=" ${SCM_GIT_CHAR_ARCHLINUX:- } " ;;
8093 * ) SCM_GIT_CHAR=" ${SCM_GIT_CHAR_DEFAULT:- } " ;;
8194 esac
0 commit comments