Skip to content

Instantly share code, notes, and snippets.

@jwhett
Created August 26, 2022 12:48
Show Gist options
  • Save jwhett/cddee4d0bd4313a467aac3c8d3a08ef3 to your computer and use it in GitHub Desktop.
Save jwhett/cddee4d0bd4313a467aac3c8d3a08ef3 to your computer and use it in GitHub Desktop.
Starship config
add_newline = true
[character]
success_symbol = "[➜](bold green)"
[package]
disabled = true
[directory]
truncation_length = 3
[time]
disabled = true
[kubernetes]
disabled = true
## Custom
[custom.giturl]
description = "Display symbol for remote Git server"
#command = """
#GIT_REMOTE=$(command git ls-remote --get-url 2> /dev/null)
#if [[ "$GIT_REMOTE" =~ "github" ]]; then
# GIT_REMOTE_SYMBOL=" "
#elif [[ "$GIT_REMOTE" =~ "gitlab" ]]; then
# GIT_REMOTE_SYMBOL=" "
#elif [[ "$GIT_REMOTE" =~ "bitbucket" ]]; then
# GIT_REMOTE_SYMBOL=" "
#elif [[ "$GIT_REMOTE" =~ "git" ]]; then
# GIT_REMOTE_SYMBOL=" "
#else
# GIT_REMOTE_SYMBOL=" "
#fi
#echo "$GIT_REMOTE_SYMBOL "
#"""
command = """
IFS="/"
GIT_REMOTE=$(command git ls-remote --get-url 2> /dev/null)
read -ra GIT_HOST <<< "$GIT_REMOTE"
if [[ "$GIT_REMOTE" =~ "github" ]]; then
GIT_REMOTE_SYMBOL=" "
elif [[ "$GIT_REMOTE" =~ "gitlab" ]]; then
GIT_REMOTE_SYMBOL=" "
elif [[ "$GIT_REMOTE" =~ "bitbucket" ]]; then
GIT_REMOTE_SYMBOL=" "
elif [[ "$GIT_REMOTE" =~ "git" ]]; then
GIT_REMOTE_SYMBOL=" "
else
GIT_REMOTE_SYMBOL=" localhost"
fi
SSH_HOST=$(echo "$GIT_HOST" | cut -d"@" -f2 | cut -d":" -f1)
printf "${GIT_HOST[2]:-$SSH_HOST}"
#printf "$GIT_REMOTE_SYMBOL${GIT_HOST[2]:-$GIT_HOST}"
IFS=" "
"""
when = 'git rev-parse --is-inside-work-tree 2> /dev/null'
shell = ["bash", "--noprofile", "--norc"]
format = "from $output "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment