mirror of
https://github.com/The-Repo-Club/DotFiles.git
synced 2024-11-25 00:38:20 -05:00
108 lines
3.1 KiB
Bash
Executable File
108 lines
3.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#-*-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:
|
|
# Tue 25 October 2022, 07:28:54 AM [GMT+1]
|
|
#
|
|
#Description:
|
|
# FZF menu for pacman yay or paru
|
|
#
|
|
#Dependencies:
|
|
# bash, pacman, yay, paru
|
|
#
|
|
|
|
function go_pacman() {
|
|
cmd=$(pacman -Slq | fzf --prompt 'pacman> ' \
|
|
--header 'Install packages. CTRL+[P/Y/R/I/Q] (Pacman/Yay/Paru/Installed/Quit)' \
|
|
--bind 'ctrl-p:change-prompt(pacman> )+reload(pacman -Slq)' \
|
|
--bind 'ctrl-y:change-prompt(yay> )+reload(yay -Slq)' \
|
|
--bind 'ctrl-r:change-prompt(paru> )+reload(paru -Slq)' \
|
|
--bind 'ctrl-i:change-prompt(inst> )+reload(yay -Qq)' \
|
|
--multi --height=80% --preview 'sleep 2; yay -Si {1}' \
|
|
--preview-window 'right,wrap' \
|
|
--reverse --header-first) #| xargs -ro pacman -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+[P/Y/R/I/Q] (Pacman/Yay/Paru/Installed/Quit)' \
|
|
--bind 'ctrl-p:change-prompt(pacman> )+reload(pacman -Slq)' \
|
|
--bind 'ctrl-y:change-prompt(yay> )+reload(yay -Slq)' \
|
|
--bind 'ctrl-r:change-prompt(paru> )+reload(paru -Slq)' \
|
|
--bind 'ctrl-i:change-prompt(inst> )+reload(yay -Qq)' \
|
|
--multi --height=80% --preview 'sleep 2; yay -Si {1}' \
|
|
--preview-window 'right,wrap' \
|
|
--reverse --header-first) #| xargs -ro yay -S
|
|
cmd=${cmd//$'\n'/ } # newline -> space
|
|
if [ -n "$cmd" ]; then
|
|
yay -S "$cmd"
|
|
fi
|
|
exit
|
|
}
|
|
|
|
function go_paru() {
|
|
cmd=$(paru -Slq | fzf --prompt 'paru> ' \
|
|
--header 'Install packages. CTRL+[P/Y/R/I/Q] (Pacman/Yay/Paru/Installed/Quit)' \
|
|
--bind 'ctrl-p:change-prompt(pacman> )+reload(pacman -Slq)' \
|
|
--bind 'ctrl-y:change-prompt(yay> )+reload(yay -Slq)' \
|
|
--bind 'ctrl-r:change-prompt(paru> )+reload(paru -Slq)' \
|
|
--bind 'ctrl-i:change-prompt(inst> )+reload(yay -Qq)' \
|
|
--multi --height=80% --preview 'sleep 2; yay -Si {1}' \
|
|
--preview-window 'right,wrap' \
|
|
--reverse --header-first) #| xargs -ro paru -S
|
|
cmd=${cmd//$'\n'/ } # newline -> space
|
|
if [ -n "$cmd" ]; then
|
|
yay -S "$cmd"
|
|
fi
|
|
exit
|
|
}
|
|
|
|
function go_installed() {
|
|
cmd=$(pacman -Qq | fzf --prompt 'installed> ' \
|
|
--header 'Installed packages. CTRL+[P/Y/R/I/Q] (Pacman/Yay/Paru/Installed/Quit)' \
|
|
--bind 'ctrl-p:change-prompt(pacman> )+reload(pacman -Slq)' \
|
|
--bind 'ctrl-y:change-prompt(yay> )+reload(yay -Slq)' \
|
|
--bind 'ctrl-r:change-prompt(paru> )+reload(paru -Slq)' \
|
|
--bind 'ctrl-i:change-prompt(installed> )+reload(yay -Qq)' \
|
|
--multi --height=80% --preview 'sleep 2; yay -Si {1}' \
|
|
--preview-window 'right,wrap' \
|
|
--reverse --header-first) #| xargs -ro pacman -S
|
|
cmd=${cmd//$'\n'/ } # newline -> space
|
|
if [ -n "$cmd" ]; then
|
|
yay -S "$cmd"
|
|
fi
|
|
exit
|
|
}
|
|
|
|
case $1 in
|
|
*pacman)
|
|
go_pacman
|
|
;;
|
|
*yay)
|
|
go_yay
|
|
;;
|
|
*paru)
|
|
go_paru
|
|
;;
|
|
*installed)
|
|
go_installed
|
|
;;
|
|
*)
|
|
go_pacman
|
|
;;
|
|
esac |