2022-10-21 02:27:25 -04:00
|
|
|
#!/usr/bin/env bash
|
2022-10-25 02:07:52 -04:00
|
|
|
#-*-coding:utf-8 -*-
|
|
|
|
#Auto updated?
|
|
|
|
# Yes
|
|
|
|
#File:
|
|
|
|
# pacsync
|
|
|
|
#Author:
|
|
|
|
# The-Repo-Club [wayne6324@gmail.com]
|
|
|
|
#Github:
|
|
|
|
# https://github.com/The-Repo-Club/
|
|
|
|
#
|
|
|
|
#Created:
|
|
|
|
# Tue 25 October 2022, 07:04:14 AM [GMT+1]
|
|
|
|
#Modified:
|
2022-10-27 17:43:30 -04:00
|
|
|
# Thu 27 October 2022, 10:10:40 PM [GMT+1]
|
2022-10-25 02:07:52 -04:00
|
|
|
#
|
|
|
|
#Description:
|
2022-10-27 17:43:30 -04:00
|
|
|
# FZF menu for pacman yay or pikaur
|
2022-10-25 02:07:52 -04:00
|
|
|
#
|
|
|
|
#Dependencies:
|
2022-10-27 17:43:30 -04:00
|
|
|
# bash, pacman, yay, pikaur
|
2022-10-25 02:07:52 -04:00
|
|
|
#
|
2022-09-05 12:16:33 -04:00
|
|
|
|
|
|
|
function go_pacman() {
|
|
|
|
cmd=$(pacman -Slq | fzf --prompt 'pacman> ' \
|
2022-10-25 02:29:05 -04:00
|
|
|
--header 'Install packages. CTRL+[P/Y/R/I/Q] (Pacman/Yay/Paru/Installed/Quit)' \
|
2022-09-05 12:16:33 -04:00
|
|
|
--bind 'ctrl-p:change-prompt(pacman> )+reload(pacman -Slq)' \
|
2022-10-25 02:07:52 -04:00
|
|
|
--bind 'ctrl-y:change-prompt(yay> )+reload(yay -Slq)' \
|
2022-10-27 17:43:30 -04:00
|
|
|
--bind 'ctrl-r:change-prompt(pikaur> )+reload(pikaur -Slq)' \
|
2022-09-05 12:16:33 -04:00
|
|
|
--bind 'ctrl-i:change-prompt(inst> )+reload(yay -Qq)' \
|
|
|
|
--multi --height=80% --preview 'sleep 2; yay -Si {1}' \
|
2022-10-25 02:29:05 -04:00
|
|
|
--preview-window 'right,wrap' \
|
|
|
|
--reverse --header-first) #| xargs -ro pacman -S
|
2022-09-05 12:16:33 -04:00
|
|
|
cmd=${cmd//$'\n'/ } # newline -> space
|
|
|
|
if [ -n "$cmd" ]; then
|
2022-09-30 02:30:13 -04:00
|
|
|
yay -S "$cmd"
|
2022-09-05 12:16:33 -04:00
|
|
|
fi
|
|
|
|
exit
|
|
|
|
}
|
|
|
|
|
|
|
|
function go_yay() {
|
|
|
|
cmd=$(yay -Slq | fzf --prompt 'yay> ' \
|
2022-10-25 02:29:05 -04:00
|
|
|
--header 'Install packages. CTRL+[P/Y/R/I/Q] (Pacman/Yay/Paru/Installed/Quit)' \
|
2022-09-05 12:16:33 -04:00
|
|
|
--bind 'ctrl-p:change-prompt(pacman> )+reload(pacman -Slq)' \
|
2022-10-25 02:07:52 -04:00
|
|
|
--bind 'ctrl-y:change-prompt(yay> )+reload(yay -Slq)' \
|
2022-10-27 17:43:30 -04:00
|
|
|
--bind 'ctrl-r:change-prompt(pikaur> )+reload(pikaur -Slq)' \
|
2022-09-05 12:16:33 -04:00
|
|
|
--bind 'ctrl-i:change-prompt(inst> )+reload(yay -Qq)' \
|
|
|
|
--multi --height=80% --preview 'sleep 2; yay -Si {1}' \
|
2022-10-25 02:29:05 -04:00
|
|
|
--preview-window 'right,wrap' \
|
|
|
|
--reverse --header-first) #| xargs -ro yay -S
|
2022-09-05 12:16:33 -04:00
|
|
|
cmd=${cmd//$'\n'/ } # newline -> space
|
|
|
|
if [ -n "$cmd" ]; then
|
2022-09-30 02:30:13 -04:00
|
|
|
yay -S "$cmd"
|
2022-09-05 12:16:33 -04:00
|
|
|
fi
|
|
|
|
exit
|
|
|
|
}
|
|
|
|
|
2022-10-25 02:07:52 -04:00
|
|
|
function go_paru() {
|
2022-10-27 17:43:30 -04:00
|
|
|
cmd=$(pikaur -Slq | fzf --prompt 'pikaur> ' \
|
2022-10-25 02:29:05 -04:00
|
|
|
--header 'Install packages. CTRL+[P/Y/R/I/Q] (Pacman/Yay/Paru/Installed/Quit)' \
|
2022-10-25 02:07:52 -04:00
|
|
|
--bind 'ctrl-p:change-prompt(pacman> )+reload(pacman -Slq)' \
|
|
|
|
--bind 'ctrl-y:change-prompt(yay> )+reload(yay -Slq)' \
|
2022-10-27 17:43:30 -04:00
|
|
|
--bind 'ctrl-r:change-prompt(pikaur> )+reload(pikaur -Slq)' \
|
2022-10-25 02:07:52 -04:00
|
|
|
--bind 'ctrl-i:change-prompt(inst> )+reload(yay -Qq)' \
|
|
|
|
--multi --height=80% --preview 'sleep 2; yay -Si {1}' \
|
2022-10-25 02:29:05 -04:00
|
|
|
--preview-window 'right,wrap' \
|
2022-10-27 17:43:30 -04:00
|
|
|
--reverse --header-first) #| xargs -ro pikaur -S
|
2022-10-25 02:07:52 -04:00
|
|
|
cmd=${cmd//$'\n'/ } # newline -> space
|
|
|
|
if [ -n "$cmd" ]; then
|
|
|
|
yay -S "$cmd"
|
|
|
|
fi
|
|
|
|
exit
|
|
|
|
}
|
|
|
|
|
2022-09-05 12:16:33 -04:00
|
|
|
function go_installed() {
|
2022-10-25 02:07:52 -04:00
|
|
|
cmd=$(pacman -Qq | fzf --prompt 'installed> ' \
|
2022-10-25 02:29:05 -04:00
|
|
|
--header 'Installed packages. CTRL+[P/Y/R/I/Q] (Pacman/Yay/Paru/Installed/Quit)' \
|
2022-09-05 12:16:33 -04:00
|
|
|
--bind 'ctrl-p:change-prompt(pacman> )+reload(pacman -Slq)' \
|
2022-10-25 02:07:52 -04:00
|
|
|
--bind 'ctrl-y:change-prompt(yay> )+reload(yay -Slq)' \
|
2022-10-27 17:43:30 -04:00
|
|
|
--bind 'ctrl-r:change-prompt(pikaur> )+reload(pikaur -Slq)' \
|
2022-09-05 12:16:33 -04:00
|
|
|
--bind 'ctrl-i:change-prompt(installed> )+reload(yay -Qq)' \
|
|
|
|
--multi --height=80% --preview 'sleep 2; yay -Si {1}' \
|
2022-10-25 02:29:05 -04:00
|
|
|
--preview-window 'right,wrap' \
|
|
|
|
--reverse --header-first) #| xargs -ro pacman -S
|
2022-09-05 12:16:33 -04:00
|
|
|
cmd=${cmd//$'\n'/ } # newline -> space
|
|
|
|
if [ -n "$cmd" ]; then
|
2022-09-30 02:30:13 -04:00
|
|
|
yay -S "$cmd"
|
2022-09-05 12:16:33 -04:00
|
|
|
fi
|
|
|
|
exit
|
|
|
|
}
|
|
|
|
|
|
|
|
case $1 in
|
|
|
|
*pacman)
|
|
|
|
go_pacman
|
|
|
|
;;
|
|
|
|
*yay)
|
|
|
|
go_yay
|
|
|
|
;;
|
2022-10-27 17:43:30 -04:00
|
|
|
*pikaur)
|
2022-10-25 02:07:52 -04:00
|
|
|
go_paru
|
|
|
|
;;
|
2022-09-05 12:16:33 -04:00
|
|
|
*installed)
|
|
|
|
go_installed
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
go_pacman
|
|
|
|
;;
|
|
|
|
esac
|