TheRepoClub-DotFiles/localbin/.local/bin/pacsync
The-Repo-Club 500942bf8c
Just a few files
Signed-off-by: The-Repo-Club <wayne6324@gmail.com>
2022-09-30 07:30:13 +01:00

63 lines
1.7 KiB
Bash
Executable File

#!/usr/bin/bash
# Dependencies:
# pacman, yay, fzf
function go_pacman() {
cmd=$(pacman -Slq | fzf --prompt 'pacman> ' \
--header 'Install packages. CTRL+(Pacman/Aur/Installed/Quit)' \
--bind 'ctrl-p:change-prompt(pacman> )+reload(pacman -Slq)' \
--bind 'ctrl-a:change-prompt(yay> )+reload(yay -Slq)' \
--bind 'ctrl-i:change-prompt(inst> )+reload(yay -Qq)' \
--multi --height=80% --preview 'sleep 2; yay -Si {1}' \
--preview-window right) #| xargs -ro yay -S
cmd=${cmd//$'\n'/ } # newline -> space
if [ -n "$cmd" ]; then
yay -S "$cmd"
fi
exit
}
function go_yay() {
cmd=$(yay -Slq | fzf --prompt 'yay> ' \
--header 'Install packages. CTRL+(Pacman/Aur/Installed/Quit)' \
--bind 'ctrl-p:change-prompt(pacman> )+reload(pacman -Slq)' \
--bind 'ctrl-a:change-prompt(yay> )+reload(yay -Slq)' \
--bind 'ctrl-i:change-prompt(inst> )+reload(yay -Qq)' \
--multi --height=80% --preview 'sleep 2; yay -Si {1}' \
--preview-window right) #| xargs -ro yay -S
cmd=${cmd//$'\n'/ } # newline -> space
if [ -n "$cmd" ]; then
yay -S "$cmd"
fi
exit
}
function go_installed() {
cmd=$(yay -Qq | fzf --prompt 'installed> ' \
--header 'Install packages. CTRL+(Pacman/Aur/Installed/Quit)' \
--bind 'ctrl-p:change-prompt(pacman> )+reload(pacman -Slq)' \
--bind 'ctrl-a:change-prompt(yay> )+reload(yay -Slq)' \
--bind 'ctrl-i:change-prompt(installed> )+reload(yay -Qq)' \
--multi --height=80% --preview 'sleep 2; yay -Si {1}' \
--preview-window right) #| xargs -ro yay -S
cmd=${cmd//$'\n'/ } # newline -> space
if [ -n "$cmd" ]; then
yay -S "$cmd"
fi
exit
}
case $1 in
*pacman)
go_pacman
;;
*yay)
go_yay
;;
*installed)
go_installed
;;
*)
go_pacman
;;
esac