refactoring to work better with descriptions
This commit is contained in:
parent
7749aa9fe9
commit
7bb851a216
28
fpf
28
fpf
|
@ -41,6 +41,16 @@ UpdateInfos() {
|
||||||
[[ "${d2///-/}" > "${d1//-/}" ]] && { echo -e "Files database is out of date\nSyncing now..."; sudo pacman -Fy; }
|
[[ "${d2///-/}" > "${d1//-/}" ]] && { echo -e "Files database is out of date\nSyncing now..."; sudo pacman -Fy; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UpdateAurInfos() {
|
||||||
|
[ -f /tmp/aur/packages-meta ] || { echo -e "Syncing AUR package database..."; zcat <(curl https://aur.archlinux.org/packages-meta-ext-v1.json.gz) |
|
||||||
|
jq --compact-output '.[] |
|
||||||
|
{ Name, Description } ' |
|
||||||
|
awk -F'"' '{ printf "%-20s %s\n", $4, $8}'> /tmp/aur/packages-meta; }
|
||||||
|
# sort <(comm -23 <(sort /tmp/aur/packages) <(pacman -Qq | sort)) <(comm -12 <(sort /tmp/aur/packages) <(pacman -Qq | sort) | awk '{print $0" \033[32m*\033[0m"}') > /tmp/aur_packages
|
||||||
|
sort -o /tmp/aur/packages-meta{,}
|
||||||
|
echo "$(echo -e ' Select packages to install\n (use TAB to toggle selection)'; cat /tmp/aur/packages-meta)" > /tmp/aur/packages-meta
|
||||||
|
}
|
||||||
|
|
||||||
# Check AUR helper
|
# Check AUR helper
|
||||||
AHELPR=""
|
AHELPR=""
|
||||||
if [[ -z "$AHELPR" ]]
|
if [[ -z "$AHELPR" ]]
|
||||||
|
@ -120,22 +130,11 @@ Remove() {
|
||||||
# Get AUR package database, remove unwanted lines, sort, mark installed, preview infos and finally hand off to yay for install
|
# Get AUR package database, remove unwanted lines, sort, mark installed, preview infos and finally hand off to yay for install
|
||||||
Aur() {
|
Aur() {
|
||||||
echo "Setting things up..."
|
echo "Setting things up..."
|
||||||
# [ -f /tmp/aur/packages-meta ] || { echo -e "Syncing AUR package database..."; wget -P /tmp/aur/ https://aur.archlinux.org/packages.gz >/dev/null 2>&1 && gunzip -f /tmp/aur/packages.gz; echo "$(tail -n +2 /tmp/aur/packages)" > /tmp/aur/packages; AurList; }
|
[ -f /tmp/aur/packages-meta ] || UpdateAurInfos
|
||||||
[ -f /tmp/aur/packages-meta ] || { echo -e "Syncing AUR package database"; zcat <(curl https://aur.archlinux.org/packages-meta-ext-v1.json.gz) |
|
|
||||||
jq --compact-output '.[] |
|
|
||||||
{ Name, Description } ' |
|
|
||||||
awk -F'"' -v OFS='\t\t' '{print $4, $8}'> /tmp/aur/packages-meta; }
|
|
||||||
d1=$(stat -c %y /tmp/aur/packages-meta)
|
d1=$(stat -c %y /tmp/aur/packages-meta)
|
||||||
d1="${d1:0:10}"
|
d1="${d1:0:10}"
|
||||||
d2=$(date -I'date')
|
d2=$(date -I'date')
|
||||||
# [[ "${d2///-/}" > "${d1//-/}" ]] && { echo -e "Syncing AUR package database..."; wget -P /tmp/aur/ https://aur.archlinux.org/packages.gz >/dev/null 2>&1 && gunzip -f /tmp/aur/packages.gz; echo "$(tail -n +2 /tmp/aur/packages)" > /tmp/aur/packages; }
|
[[ "${d2///-/}" > "${d1//-/}" ]] && UpdateAurInfos
|
||||||
[[ "${d2///-/}" > "${d1//-/}" ]] && { echo -e "Syncing AUR package database..."; zcat <(curl https://aur.archlinux.org/packages-meta-ext-v1.json.gz) |
|
|
||||||
jq --compact-output '.[] |
|
|
||||||
{ Name, Description } ' |
|
|
||||||
awk -F'"' -v OFS='\t\t' '{print $4, $8}'> /tmp/aur/packages-meta; }
|
|
||||||
# sort <(comm -23 <(sort /tmp/aur/packages) <(pacman -Qq | sort)) <(comm -12 <(sort /tmp/aur/packages) <(pacman -Qq | sort) | awk '{print $0" \033[32m*\033[0m"}') > /tmp/aur_packages
|
|
||||||
sort -o /tmp/aur/packages-meta{,}
|
|
||||||
echo "$(echo -e ' Select packages to install\n (use TAB to toggle selection)'; cat /tmp/aur/packages-meta)" > /tmp/aur/packages-meta
|
|
||||||
cat /tmp/aur/packages-meta |
|
cat /tmp/aur/packages-meta |
|
||||||
fzf -q "$1" -e -m \
|
fzf -q "$1" -e -m \
|
||||||
--preview='cat <(yay -Si {1} 2>/dev/null || paru -Si {1}) <(pacman -Ql {1} 2>/dev/null | awk "{print \$2}")' \
|
--preview='cat <(yay -Si {1} 2>/dev/null || paru -Si {1}) <(pacman -Ql {1} 2>/dev/null | awk "{print \$2}")' \
|
||||||
|
@ -218,9 +217,6 @@ else
|
||||||
-R|--remove)
|
-R|--remove)
|
||||||
Remove "$2"
|
Remove "$2"
|
||||||
;;
|
;;
|
||||||
-u|--update)
|
|
||||||
AurList
|
|
||||||
;;
|
|
||||||
-h|--help)
|
-h|--help)
|
||||||
Help
|
Help
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Reference in New Issue