short repos status added to giti
This commit is contained in:
parent
22aa8ab62a
commit
fcfcf72c41
55
giti
55
giti
@ -5,6 +5,7 @@ while getopts "hnrs" options; do
|
|||||||
case $options in
|
case $options in
|
||||||
n ) NO_DETAILS="True";;
|
n ) NO_DETAILS="True";;
|
||||||
r ) REPEAT="True";;
|
r ) REPEAT="True";;
|
||||||
|
s ) SHORT="True";;
|
||||||
h ) echo $usage
|
h ) echo $usage
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
@ -29,24 +30,44 @@ else
|
|||||||
git_status="$(LANGUAGE='en_US.UTF-8 git' git status 2> /dev/null)"
|
git_status="$(LANGUAGE='en_US.UTF-8 git' git status 2> /dev/null)"
|
||||||
git_diff="$(git status --porcelain 2> /dev/null)"
|
git_diff="$(git status --porcelain 2> /dev/null)"
|
||||||
#
|
#
|
||||||
if [[ ! $git_status = "" ]]; then
|
if [[ $SHORT ]]; then
|
||||||
git_branch="$(git branch 2> /dev/null | sed --quiet 's/* \(.*\)/\1/p')"
|
if [[ ! $git_status =~ "working tree clean" ]] && [[ ! $git_status =~ "working directory clean" ]]; then
|
||||||
git_url="$(git config --get remote.origin.url 2> /dev/null)"
|
git_status_color="$COLOR_RED"
|
||||||
if [[ ! $git_status =~ "working tree clean" ]] && [[ ! $git_status =~ "working directory clean" ]]; then
|
git_status_text="local changes"
|
||||||
git_status_color="$COLOR_RED"
|
elif [[ $git_status =~ "Your branch is behind" ]]; then
|
||||||
git_status_text="╡ local changes ╞"
|
git_status_color="$COLOR_YELLOW"
|
||||||
elif [[ $git_status =~ "Your branch is behind" ]]; then
|
git_status_text="pull required"
|
||||||
git_status_color="$COLOR_YELLOW"
|
elif [[ $git_status =~ "Your branch is ahead of" ]]; then
|
||||||
git_status_text="╡ pull required ╞"
|
git_status_color="$COLOR_YELLOW"
|
||||||
elif [[ $git_status =~ "Your branch is ahead of" ]]; then
|
git_status_text="push required"
|
||||||
git_status_color="$COLOR_YELLOW"
|
elif [[ $git_status =~ "nothing to commit" ]]; then
|
||||||
git_status_text="╡ push required ╞"
|
git_status_color="$COLOR_DARKGREEN"
|
||||||
elif [[ $git_status =~ "nothing to commit" ]]; then
|
git_status_text="clean "
|
||||||
git_status_color="$COLOR_DARKGREEN"
|
else
|
||||||
git_status_text="╡ clean ╞════════"
|
git_status_color="$COLOR_OCHRE"
|
||||||
|
git_status_text="unknown "
|
||||||
|
fi
|
||||||
|
echo -ne "$git_status_color$git_status_text$COLOR_WHITE"
|
||||||
else
|
else
|
||||||
git_status_color="$COLOR_OCHRE"
|
if [[ ! $git_status = "" ]]; then
|
||||||
git_status_text="╡ unknown ╞══════"
|
git_branch="$(git branch 2> /dev/null | sed --quiet 's/* \(.*\)/\1/p')"
|
||||||
|
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 ╞"
|
||||||
|
elif [[ $git_status =~ "Your branch is behind" ]]; then
|
||||||
|
git_status_color="$COLOR_YELLOW"
|
||||||
|
git_status_text="╡ pull required ╞"
|
||||||
|
elif [[ $git_status =~ "Your branch is ahead of" ]]; then
|
||||||
|
git_status_color="$COLOR_YELLOW"
|
||||||
|
git_status_text="╡ push required ╞"
|
||||||
|
elif [[ $git_status =~ "nothing to commit" ]]; then
|
||||||
|
git_status_color="$COLOR_DARKGREEN"
|
||||||
|
git_status_text="╡ clean ╞════════"
|
||||||
|
else
|
||||||
|
git_status_color="$COLOR_OCHRE"
|
||||||
|
git_status_text="╡ unknown ╞══════"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "$git_status_color╔═══$git_status_text════════════════════════════════════════════════════════════════"
|
echo -e "$git_status_color╔═══$git_status_text════════════════════════════════════════════════════════════════"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user