fix: regexp filtering

This commit is contained in:
Michel 2024-06-20 13:00:06 +02:00
parent 5fbb30c70e
commit 4a97e49deb

View File

@ -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}"