Skip to content

Commit

Permalink
Fix some linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
olsonbg committed Apr 5, 2019
1 parent d12f6a7 commit e0bc5f7
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions dirs/bash.d/common/prompt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@ function __prompt_command()
local PURPLE=$E'[0;35m'$R
local NONE=$E'[0m'$R

SUS=`ps T |grep -v "grep"|grep -c " su"|grep -v "^0"`
SUS=$(ps T |grep -v "grep"|grep -c " su"|grep -v "^0")

PS1+="$CYAN\h$CYAN($YEL\u$CYAN)$NONE"
PS1+="$YEL$SUS$NONE"
PS1+="$CYAN:\W$NONE"

# Show virtualenv virtual environment if one is active
if [ -n "$VIRTUAL_ENV" ]; then
local virtualenv=$(basename "$VIRTUAL_ENV")
local virtualenv
virtualenv=$(basename "$VIRTUAL_ENV")
PS1+="$CYAN(${PURPLE}v:$YEL$virtualenv$CYAN)$NONE"
fi

Expand All @@ -38,9 +39,12 @@ function __prompt_command()
PS1+="$CYAN(${PURPLE}jobid:$YEL$SLURM_JOBID$CYAN)$NONE"
fi

local git_status="$(git status 2>&1)"
local git_status
local Color_On
local branch

git_status="$(git status 2>&1)"

if ! [[ "$git_status" =~ [nN]ot\ a\ git\ repo ]]; then
if [[ "$git_status" =~ nothing\ to\ commit ]]; then
Color_On=$GREEN;
Expand All @@ -58,13 +62,15 @@ function __prompt_command()

# Anything stashed?
local s
if $(git rev-parse --verify --quiet refs/stash >/dev/null); then
if git rev-parse --verify --quiet refs/stash >/dev/null; then
s="$"
fi

# How many commits we are ahead/behind our upstream
local p
local count=$(git rev-list --count --left-right @{upstream}...HEAD 2>/dev/null)
local count

count=$(git rev-list --count --left-right "@{upstream}...HEAD" 2>/dev/null)

case "$count" in
"") # no upstream
Expand All @@ -79,7 +85,7 @@ function __prompt_command()
p="+${count#* }-${count% *}" ;;
esac

PS1+=" $Color_On[$branch$s$p]$NONE"
PS1+=" ${Color_On}[$branch$s$p]$NONE"
fi

# PS1+='$(__git_ps1 " [%s]")'
Expand Down

0 comments on commit e0bc5f7

Please sign in to comment.