giti: adaption for kali_prompt

Šī revīzija ir iekļauta:
Dirk Alders 2023-06-17 14:26:03 +00:00
vecāks 2ee1207ad3
revīzija 993cf955fb

44
giti
Parādīt failu

@ -1,6 +1,6 @@
#!/bin/bash
#
usage="Usage: $0 [-n | no details] [-r | repeat]"
usage="Usage: $0 [-n | no details] [-r | repeat]"
while getopts "hnrs" options; do
case $options in
n ) NO_DETAILS="True";;
@ -58,36 +58,40 @@ else
git_url="$(git config --get remote.origin.url 2> /dev/null)"
if [[ ! $git_status =~ "working tree clean" ]] && [[ ! $git_status =~ "working directory clean" ]]; then
git_status_color="$COLOR_RED"
git_status_text="local changes"
git_status_text="local changes"
elif [[ $git_status =~ "Your branch is behind" ]]; then
git_status_color="$COLOR_YELLOW"
git_status_text="pull required"
git_status_text="pull required"
elif [[ $git_status =~ "Your branch is ahead of" ]]; then
git_status_color="$COLOR_YELLOW"
git_status_text="push required"
git_status_text="push required"
elif [[ $git_status =~ "nothing to commit" ]]; then
git_status_color="$COLOR_DARKGREEN"
git_status_text="╡ clean ╞════════"
git_status_text="clea "
else
git_status_color="$COLOR_OCHRE"
git_status_text="╡ unknown ╞══════"
git_status_text="unknown "
fi
fi
echo -e "$git_status_color╔═══$git_status_text════════════════════════════════════════════════════════════════"
echo -e "$git_status_color║ $COLOR_GREEN($git_branch) $COLOR_CYAN$git_url"
if [[ $NO_DETAILS ]]; then
echo -e "$git_status_color╠══$COLOR_GREEN($git_branch)$git_status_color - $git_status_text - $COLOR_CYAN$git_url$COLOR_WHITE\n\b"
else
echo -e "$git_status_color╔═══╡ $git_status_text ╞════════════════════════════════════════════════════════════════"
echo -e "$git_status_color║ $COLOR_GREEN($git_branch) $COLOR_CYAN$git_url"
if [[ ! $git_diff == "" && $NO_DETAILS != "True" ]]; then
echo -e "$git_status_color╠════════════════════════════════════════════════════════════════════════════════════"
IFS=$'\n'
for ENTRY in $git_diff; do
if [[ $ENTRY = "D "* ]] || [[ $ENTRY = "A "* ]] || [[ $ENTRY = "M "* ]] || [[ $ENTRY = "R "* ]]; then
echo -e "$git_status_color║ $COLOR_DARKYELLOW$ENTRY"
else
echo -e "$git_status_color║ $COLOR_YELLOW$ENTRY"
fi
done
fi
echo -e "$git_status_color╚════════════════════════════════════════════════════════════════════════════════════$COLOR_WHITE\n \b"
if [[ ! $git_diff == "" ]]; then
echo -e "$git_status_color╠════════════════════════════════════════════════════════════════════════════════════"
IFS=$'\n'
for ENTRY in $git_diff; do
if [[ $ENTRY = "D "* ]] || [[ $ENTRY = "A "* ]] || [[ $ENTRY = "M "* ]] || [[ $ENTRY = "R "* ]]; then
echo -e "$git_status_color║ $COLOR_DARKYELLOW$ENTRY"
else
echo -e "$git_status_color║ $COLOR_YELLOW$ENTRY"
fi
done
fi
echo -e "$git_status_color╚════════════════════════════════════════════════════════════════════════════════════$COLOR_WHITE\n \b"
fi
fi
fi