From 47118a524101fbc9b419b474b75277b16ad07e0b Mon Sep 17 00:00:00 2001 From: Pilaton Date: Wed, 22 Nov 2023 12:46:59 +0300 Subject: [PATCH] feat: Many small improvements --- .github/workflows/release-please.yml | 3 ++- ohmyzsh-full-autoupdate.plugin.zsh | 25 +++++++++++++------------ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 179bf84..235e482 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -2,13 +2,14 @@ on: push: branches: - main + name: 🚀 release-please jobs: release-please: runs-on: ubuntu-latest steps: - name: 🕺 release - uses: GoogleCloudPlatform/release-please-action@v2 + uses: GoogleCloudPlatform/release-please-action@v3 id: release with: release-type: simple diff --git a/ohmyzsh-full-autoupdate.plugin.zsh b/ohmyzsh-full-autoupdate.plugin.zsh index 66a2571..a63da01 100644 --- a/ohmyzsh-full-autoupdate.plugin.zsh +++ b/ohmyzsh-full-autoupdate.plugin.zsh @@ -23,7 +23,7 @@ fi ####################################### # Set colors if "tput" is present in the system ####################################### -if [[ ! -z $(which tput 2> /dev/null) ]]; then +if [[ -n $(command -v tput) ]]; then bold=$(tput bold) colorGreen=$(tput setaf 2) colorYellow=$(tput setaf 3) @@ -76,8 +76,8 @@ printf '\n' # [text...] Url ####################################### _getUrlGithub() { - local URL=$(grep 'url =' "${1}/config" | grep -o 'https://\S*' | sed 's/\.git//') - echo $URL + local url=$(grep 'url =' "$1/config" | grep -o 'https://\S*' | sed 's/\.git//') + echo $url } ####################################### @@ -88,9 +88,10 @@ _getUrlGithub() { # [text...] Name category ####################################### _getNameCustomCategory() { - case ${1} in - *"plugins"*) echo "Plugin" ; return 0 ;; - *"themes"*) echo "Theme" ; return 0 ;; + local path=$1 + case $path in + *"plugins"*) echo "Plugin" ;; + *"themes"*) echo "Theme" ;; esac } @@ -101,7 +102,6 @@ _getNameCustomCategory() { ####################################### _savingLabel() { echo "\nLABEL_FULL_AUTOUPDATE=true" >> "${ZSH_CACHE_DIR}/.zsh-update" - return 0 } ####################################### @@ -110,7 +110,7 @@ _savingLabel() { # ZSH_CUSTOM ####################################### omzFullUpdate() { - local arrayPackages=( $(find -L "${ZSH_CUSTOM}" -type d -name ".git") ) + local arrayPackages=($(find -L "${ZSH_CUSTOM}" -type d -name ".git")) for package in ${arrayPackages[@]}; do local urlGithub=$(_getUrlGithub "$package") @@ -118,12 +118,13 @@ omzFullUpdate() { local packageDir=$(dirname "$package") local packageName=$(basename "$packageDir") - echo "${colorYellow}Updating ${nameCustomCategory}${reset} — ${colorGreen}${packageName}${reset} -> ${colorBlue}($urlGithub)${reset}" - git -C "${packageDir}" pull - echo "" + printf '%sUpdating %s — %s -> %s\n' "$colorYellow" "$nameCustomCategory" "$colorGreen$packageName$reset" "$colorBlue$urlGithub$reset" + if ! git -C "$packageDir" pull; then + printf '%sError updating %s%s\n' "$colorRed" "$packageName" "$reset" + fi + printf '\n' done - # Start the function of saving the label _savingLabel } omzFullUpdate