upd: refactor, add nvim
This commit is contained in:
parent
15bf23eb3f
commit
9786e54eb8
1 changed files with 21 additions and 1 deletions
|
@ -23,11 +23,31 @@ fi
|
|||
# Avoiding copy pasting this over and over
|
||||
g() { git -C "$REPO" "$@"; }
|
||||
|
||||
# path_append from https://superuser.com/questions/39751/add-directory-to-path-if-its-not-already-there
|
||||
# checks if a path is already in the PATH and if it exists
|
||||
path_append() {
|
||||
if [ -d "$1" ]; then
|
||||
# shellcheck disable=SC3010
|
||||
if command '[[' > /dev/null 2>&1 && [[ ":$REPOS_TO_UPDATE:" != *":$1:"* ]]; then
|
||||
REPOS_TO_UPDATE="${REPOS_TO_UPDATE:+"$REPOS_TO_UPDATE:"}$1"
|
||||
else
|
||||
REPOS_TO_UPDATE="$REPOS_TO_UPDATE:$1"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2016
|
||||
REPO_ABBR='echo ${REPO/"$HOME"/"~"}'
|
||||
|
||||
path_append "${DOCS_DIR:-}"
|
||||
path_append "$HOME/bin"
|
||||
path_append "${NIXOS_DIR:-}"
|
||||
path_append "$HOME/code/faust-ideas"
|
||||
path_append "$HOME/code/nixvim-config"
|
||||
path_append "$HOME/.config/nvim"
|
||||
|
||||
# `git pull` everything mentioned in the REPOS_TO_UPDATE variable
|
||||
IFS=: read -ra REPOS_TO_UPDATE_ARR <<< "${REPOS_TO_UPDATE:-}:${DOCS_DIR:-}:$HOME/bin:${NIXOS_DIR:-}:$HOME/code/faust-ideas:$HOME/code/nixvim-config"
|
||||
IFS=: read -ra REPOS_TO_UPDATE_ARR <<< "${REPOS_TO_UPDATE:-}"
|
||||
for REPO in "${REPOS_TO_UPDATE_ARR[@]}"; do
|
||||
if [ -n "$REPO" ]; then
|
||||
if g rev-parse > /dev/null 2>&1; then
|
||||
|
|
Loading…
Add table
Reference in a new issue