Add return code validation to .ps1

This commit is contained in:
fanyx 2021-05-19 12:15:47 +02:00
parent 25759d9a4d
commit 1fdc598871
1 changed files with 9 additions and 1 deletions

10
.ps1
View File

@ -6,6 +6,14 @@ NC='\[\033[00m\]'
GREEN='\[\033[01;32m\]' GREEN='\[\033[01;32m\]'
YELLOW='\[\033[01;33m\]' YELLOW='\[\033[01;33m\]'
BLUE='\[\033[01;34m\]' BLUE='\[\033[01;34m\]'
RED='\[\033[01;31m\]'
PS1="${GREEN}\u@\h${NC}:${BLUE}\w${YELLOW}\$(__git_ps1 ' [%s]')${NC} \$ " SMILEY="${GREEN}:)${NC}"
FROWNY="${RED}:(${NC}"
SELECT="if [ \$? = 0 ]; then echo \"${SMILEY}\"; else echo \"${FROWNY}\"; fi"
GIT_BRANCH="$(__git_ps1 ' [%s]')"
PS1="${GREEN}\u@\h${NC}:${BLUE}\w${NC} \`${SELECT}\`${YELLOW}\$(__git_ps1 ' [%s]')${NC} \$ "