-
-
Save ZwodahS/4b53f5fb1312347f22e3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# git + ls | |
C_RED=$(tput setaf 1) | |
C_GREEN=$(tput setaf 2) | |
C_YELLOW=$(tput setaf 3) | |
C_BLUE=$(tput setaf 4) | |
C_MAGENTA=$(tput setaf 5) | |
C_CYAN=$(tput setaf 6) | |
C_WHITE=$(tput setaf 7) | |
C_CLEAR=$(tput sgr0) | |
IFS="" | |
ls -lh --color | while read LINE; do | |
if $(git rev-parse --git-dir >/dev/null 2>&1); then | |
FILE=$(echo $LINE | rev | cut -d ' ' -f 1 | rev | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g") | |
STATUS=$(git status -s $FILE | sed 's/^ *//g' | cut -d ' ' -f 1) | |
if [ "$STATUS" == "M" ]; then | |
AUGMENT="${C_RED}(modified)${C_CLEAR}" | |
elif [ "$STATUS" == "??" ]; then | |
AUGMENT="${C_YELLOW}(untracked)${C_CLEAR}" | |
else | |
AUGMENT="${C_WHITE}(no change)${C_CLEAR}" | |
fi | |
echo $LINE $AUGMENT | |
else | |
echo $LINE; | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment