From 4a97e49deb8bbddcd725f5aff26c16a8aa945a02 Mon Sep 17 00:00:00 2001 From: Michel Date: Thu, 20 Jun 2024 13:00:06 +0200 Subject: [PATCH] fix: regexp filtering --- bin/versions_check | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/bin/versions_check b/bin/versions_check index 1538d94..eba2e64 100755 --- a/bin/versions_check +++ b/bin/versions_check @@ -31,7 +31,7 @@ function print_age # Already installed # if (( ${+commands[$program]} )); then - echo "\n${bg[cyan]} Installed ${reset_color}" + echo "\n${bg[cyan]} Installation Age ${reset_color}" prog_out=$(${program} -V) @@ -42,6 +42,8 @@ function print_age echo ${prog_out} | grep --colour=always -F "${current_version}" lsd -lh --date=relative =${program} fi + + echo } # Debian Package @@ -81,9 +83,9 @@ function debian if [ $? -eq 0 ]; then echo "${fg[red]}${repo_version}${fg[cyan]} > ${current_version}${reset_color}\n" - echo -n ${repository}/releases - echo "${fg[cyan]}" - lastversion ${repository} --filter="${filter}" --assets + echo "${fg[cyan]}${repository}/releases/latest${reset_color}" + lastversion ${repository} --assets --filter="." \ + | rg --color=always --passthru --regexp="${filter}" else echo "${fg[green]}${repo_version}" @@ -149,9 +151,9 @@ function archive if [ $? -eq 0 ]; then echo "${fg[red]}${repo_version}${fg[cyan]} > ${current_version}${reset_color}\n" - echo -n ${repository}/releases - echo "${fg[cyan]}" - lastversion ${repository} --filter="${filter}" --assets + echo "${fg[cyan]}${repository}/releases/latest${reset_color}" + lastversion ${repository} --assets --filter="." \ + | rg --color=always --passthru --regexp="${filter}" else echo "${fg[green]}${repo_version}" @@ -162,13 +164,13 @@ function archive ### -filter=amd64\\.deb +filter='([^/]+amd64\.deb|\w+\.txt)$' -debian bat "https://github.com/sharkdp/bat" -debian delta "https://github.com/dandavison/delta" git-delta -debian lsd "https://github.com/lsd-rs/lsd" +debian bat 'https://github.com/sharkdp/bat' +debian delta 'https://github.com/dandavison/delta' git-delta +debian lsd 'https://github.com/lsd-rs/lsd' -filter=Linux_x86_64 +filter='(Linux_x86_64|\w*\.appimage$|\w+\.appimage\.\w+sum$|\w+\.txt$)' archive lazygit https://github.com/jesseduffield/lazygit archive nvim https://github.com/neovim/neovim @@ -179,8 +181,8 @@ print_age nnn setopt nullglob fonts=( $(echo /opt/fonts/**/*NerdFont* $HOME/.fonts/**/*NerdFont*) ) if (( ${#fonts} )); then - font_version=$(lastversion format "$(strings ${fonts[1]} | grep -o "Nerd Fonts [0-9.]\\+")") + font_version=$(lastversion format "$(strings ${fonts[1]} | grep -o 'Nerd Fonts [0-9.]\+')") fi -filter="(JetBrainsMono|NerdFontsSymbolsOnly).tar.xz" +filter='((JetBrainsMono|NerdFontsSymbolsOnly)\.tar\.xz|\w+\.txt)$' archive "Nerd Fonts" https://github.com/ryanoasis/nerd-fonts "${font_version}"