Move bulk of code-check to shared as git-check so that it can be used anywhere (such as ZZ_INACTIVE). Reference the new function and pass the dir we want to check.
This commit is contained in:
@@ -619,33 +619,7 @@
|
|||||||
alias docker-start="docker compose up -d && docker compose start"
|
alias docker-start="docker compose up -d && docker compose start"
|
||||||
alias docker-prep="docker compose pull && docker compose build"
|
alias docker-prep="docker compose pull && docker compose build"
|
||||||
alias_code_check: |
|
alias_code_check: |
|
||||||
alias code-check='
|
alias code-check='git-check $HOME/Code'
|
||||||
echo "Checking ~/Code directory for git changes."
|
|
||||||
ls -d ~/Code/* | while read project; do
|
|
||||||
if [[ ! -d $project ]]; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
echo -e "\n*** `basename $project` ***"
|
|
||||||
cd $project
|
|
||||||
if [[ -d .git ]]; then
|
|
||||||
git ls-remote --exit-code --heads origin dev
|
|
||||||
dev_exists="$?"
|
|
||||||
if [[ "$dev_exists" == 0 ]]; then
|
|
||||||
git switch dev
|
|
||||||
elif [[ "$dev_exists" == 2 ]]; then
|
|
||||||
git switch main
|
|
||||||
else
|
|
||||||
echo "ERROR: Unknown status for dev_exists, '$dev_exists'."
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
git pull
|
|
||||||
git push
|
|
||||||
else
|
|
||||||
echo "Not a Git project, skipping!"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
echo -e "\nDone!"
|
|
||||||
'
|
|
||||||
alias code-sync='code-check'
|
alias code-sync='code-check'
|
||||||
alias_code_reset: |
|
alias_code_reset: |
|
||||||
alias code-reset='
|
alias code-reset='
|
||||||
|
|||||||
Reference in New Issue
Block a user