forked from mkbula/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpkg-install
More file actions
executable file
·33 lines (29 loc) · 1.06 KB
/
Copy pathpkg-install
File metadata and controls
executable file
·33 lines (29 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
source "$HOME/.local/share/dotfiles/bin/lib/helpers.sh"
fzf_args=(
--multi
--preview 'yay -Si {2}'
--preview-label='alt-p: toggle desc, alt-b/B: toggle PKGBUILD, alt-j/k: scroll, tab: multi-select'
--preview-label-pos='bottom'
--preview-window 'down:55%:wrap'
--bind 'alt-p:toggle-preview'
--bind 'alt-d:preview-half-page-down,alt-u:preview-half-page-up'
--bind 'alt-k:preview-up,alt-j:preview-down'
--bind 'alt-b:change-preview:yay -Gpa {2} | tail -n +5'
--bind 'alt-B:change-preview:yay -Siia {2}'
--color 'pointer:green,marker:green'
)
format_packages() {
awk '{
colors["core"] = "\033[34m"; colors["extra"] = "\033[32m"; colors["aur"] = "\033[33m"
color = ($1 in colors) ? colors[$1] : "\033[0m"
installed = ($4 == "[installed]") ? " [installed]" : ""
printf "%s[%s]\033[0m %s%s\n", color, $1, $2, installed
}'
}
pkg_names=$(yay -Sl | format_packages | fzf "${fzf_args[@]}" --ansi | awk '{print $2}')
if [[ -n "$pkg_names" ]]; then
echo "$pkg_names" | tr '\n' ' ' | xargs yay -S --noconfirm
sudo updatedb
show_done
fi