From ee186f728597f04ae5c4615e1da6a786c1f51e0b Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 1 Nov 2020 16:21:57 +0200 Subject: [PATCH] [scripts/archlinux-packages-menu] add listing of packages from AUR --- scripts/archlinux-packages-menu | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/scripts/archlinux-packages-menu b/scripts/archlinux-packages-menu index 0ef8453..72a39b8 100755 --- a/scripts/archlinux-packages-menu +++ b/scripts/archlinux-packages-menu @@ -1,6 +1,18 @@ #!/usr/bin/env bash set -euo pipefail -if package="$(expac --sync '%r/%a/%n %v - %d' | rofi -dmenu)" && [[ -n "$package" ]]; then - xdg-open "https://www.archlinux.org/packages/${package%% *}/" +if package="$(set -euo pipefail; { + expac --sync '%r/%a/%n %v - %d' + curl --silent --location --fail --max-time 3 --compressed https://aur.archlinux.org/packages.gz | awk '!/^#/ { print "aur/" $0 }' +} | rofi -dmenu)" && [[ -n "$package" ]]; then + + package="${package%% *}" + if [[ "$package" == aur/* ]]; then + package="${package#aur/}" + url="https://aur.archlinux.org/packages/${package}/" + else + url="https://www.archlinux.org/packages/${package}/" + fi + + xdg-open "$url" fi