diff options
| author | Tslil Clingman <tslil.clingman@gmail.com> | 2017-05-28 17:32:03 -0500 |
|---|---|---|
| committer | Tslil Clingman <tslil.clingman@gmail.com> | 2017-05-28 17:32:03 -0500 |
| commit | 721668ea57fda4254ceee9146c6b6bee470b3fc6 (patch) | |
| tree | f0f7a8078c601d47dd521567749b215f9ca36373 /vcs | |
| parent | 6d1077a28b8d6f64ca72b9aa00f0b2cab97fb594 (diff) | |
Ran shellcheck, fixed (?) things
Diffstat (limited to 'vcs')
| -rwxr-xr-x | vcs | 37 |
1 files changed, 22 insertions, 15 deletions
@@ -11,7 +11,7 @@ VCS_MOD="" VCS_REC="" SPC="" -if [[ $1 == "--zsh-colour" ]]; then +if [ "$1" = "--zsh-colour" ]; then nstr="%F{red}●%f" mstr="%F{11}●%f" rstr="%F{28}●%f" @@ -27,35 +27,42 @@ else cEND="" fi -if [[ -d ".git" || -d "../.git" || -d "../../.git" ]]; then +if [ -d ".git" ] || [ -d "../.git" ] || [ -d "../../.git" ]; then outp=$(git status) VCS_STR="*" VCS_INF=$(echo "$outp" | head -n 1 | cut -d' ' -f 3-) - check "^Untracked files:$" "$outp" - [[ $? = 0 ]] && VCS_NEW=$nstr - check "^Changes not staged for commit:$" "$outp" - [[ $? = 0 ]] && VCS_MOD=$mstr - check "^Changes to be committed:$" "$outp" - [[ $? = 0 ]] && VCS_REC=$rstr -else if [[ -d "_darcs" || -d "../_darcs" || -d "../../_darcs" ]]; then + if check "^Untracked files:$" "$outp"; then + VCS_NEW=$nstr + fi; + if check "^Changes not staged for commit:$" "$outp"; then + VCS_MOD=$mstr + fi; + if check "^Changes to be committed:$" "$outp"; then + VCS_REC=$rstr + fi; +elif [ -d "_darcs" ] || [ -d "../_darcs" ] || [ -d "../../_darcs" ]; then fls=$(darcs show files) VCS_STR="+" VCS_INF=$(darcs show repo | grep Default | cut -d : -f 3-) for f in ./*; do - if [[ -f $f ]]; then - echo "$fls" | grep -q $f + if [ -f "$f" ]; then + echo "$fls" | grep -q "$f" else true fi; - if [[ ! $? = 0 ]]; then + if [ ! $? = 0 ]; then VCS_NEW=$nstr; break; fi; done; news=$(darcs what)$ - check "^No changes" "$news" - [[ $? = 0 ]] || VCS_REC=$rstr -fi; fi; + if check "^No changes" "$news"; then + true + else + VCS_REC=$rstr; + fi; + +fi; [ -n "$VCS_NEW$VCS_MOD$VCS_REC" ] && SPC=" " [ -n "$VCS_STR" ] && echo "$cFST$VCS_STR$cEND{$cSND$VCS_INF$cEND$SPC$VCS_NEW$VCS_MOD$VCS_REC}" |
