From 16ae0923217468b9d94aa6b82d5d74b9421b112e Mon Sep 17 00:00:00 2001 From: piecka Date: Tue, 25 Mar 2025 09:35:50 +0100 Subject: [PATCH] fix some things --- .zshrc | 45 +++++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/.zshrc b/.zshrc index 90695fe..0635500 100644 --- a/.zshrc +++ b/.zshrc @@ -354,38 +354,43 @@ __alias__() { alias gcm="git commit -m" alias gpu="git push --recurse-submodule=on-demand" gsu() { - echo "| git submodule foreach git pull --recurse-submodule |" + echo "${YELLOW}${BOLD}| git submodule foreach git pull --recurse-submodule |${NC}" git submodule foreach git pull --recurse-submodule && - echo "-- pulled down submodules recursively" + echo "${CYAN}-- pulled down submodules recursively${NC}" - echo "| git submodule update --init --recursive |" - git submodule update --init --recursive + echo "${YELLOW}| git submodule update --init --recursive |${NC}" + git submodule update --init --recursive && + echo "${CYAN}-- updated submodules recursively${NC}" - echo "-- Checking submodule branches... --" + echo "${YELLOW}-- Checking submodule branches... --${NC}" git submodule foreach ' branch=$(git symbolic-ref --short HEAD 2>/dev/null || echo "detached") if [ "$branch" = "detached" ]; then default_branch=$(git config -f $toplevel/.gitmodules submodule.$name.branch || echo "main") - echo "Submodule $name is detached. Checking out $default_branch..." + echo "${RED}Submodule $name is detached. Checking out $default_branch...${NC}" git checkout $default_branch else - echo "Submodule $name is on branch $branch." + echo "${CYAN}Submodule $name is on branch $branch.${NC}" fi ' - if git diff --quiet .; then - echo_info "Staging changes..." - git add . - sleep 0.3 - if git commit -m " update: submodules"; then - echo_info "Changes committed successfully." + gUpdateModules() { + if git diff --quiet .; then + echo_info "Staging changes..." + git add . + sleep 0.3 + if git commit -m " update: submodules"; then + echo_info "Changes committed successfully." + else + echo_error "Failed to commit changes." + return 1 + fi else - echo_error "Failed to commit changes." - return 1 + echo_info "No changes to commit." fi - else - echo_info "No changes to commit." - fi + } + + gUpdateModules if git push; then echo_info "Push successful." @@ -393,6 +398,10 @@ __alias__() { echo_error "Failed to push changes." return 1 fi + + # gUpdateModules + + error_log } gwip() {