upd: add check for if tput exists and if git repo is a repo
This commit is contained in:
parent
dd8865daa4
commit
789c1039b1
1 changed files with 9 additions and 4 deletions
|
@ -1,12 +1,17 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
if command -v tput > /dev/null; then
|
||||||
|
GREEN="$(tput setaf 2)"
|
||||||
|
NC="$(tput sgr0)"
|
||||||
|
fi
|
||||||
|
|
||||||
# Check for updates for thing in the REPOS_TO_UPDATE variable
|
# Check for updates for thing in the REPOS_TO_UPDATE variable
|
||||||
IFS=: read -ra REPOS_TO_UPDATE_ARR <<< "$REPOS_TO_UPDATE:$DOCS_DIR:$HOME/bin"
|
IFS=: read -ra REPOS_TO_UPDATE_ARR <<< "$REPOS_TO_UPDATE:$DOCS_DIR:$HOME/bin"
|
||||||
for REPO in "${REPOS_TO_UPDATE_ARR[@]}"; do
|
for REPO in "${REPOS_TO_UPDATE_ARR[@]}"; do
|
||||||
tput setaf 2
|
if git -C "$REPO" rev-parse > /dev/null 2>&1; then
|
||||||
echo " Pulling ${REPO/$HOME/"~"}‥"
|
echo " ${GREEN}Pulling ${REPO/$HOME/"~"}‥${NC}"
|
||||||
tput sgr0
|
git -C "$REPO" pull
|
||||||
git -C "$REPO" pull
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# check for dotfiles updates
|
# check for dotfiles updates
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue