24 lines
1.1 KiB
Fish
24 lines
1.1 KiB
Fish
function fbps
|
|
argparse 'h/help' 'i/install' 'r/remove' 'c/clean' -- $argv
|
|
or return
|
|
|
|
set --local -x FZF_DEFAULT_OPTS '--cycle --layout=reverse --border --height=40% --preview-window=wrap --marker="*" --color=bg+:#313244,spinner:#f5e0dc,hl:#f38ba8 --color=fg:#cdd6f4,header:#f38ba8,info:#cba6f7,pointer:#f5e0dc --color=marker:#f5e0dc,fg+:#cdd6f4,prompt:#cba6f7,hl+:#f38ba8'
|
|
|
|
if set -ql _flag_remove
|
|
xbps-query -l | rg -o --pcre2 '(?<=\\w{2}\\s)[A-z-]*(?=-\\d+.*)' | fzf -q "$1" -m --preview 'xbps-query {1} | bat -p --language yaml --color=always' | xargs -ro sudo xbps-remove
|
|
else if set -ql _flag_install
|
|
xbps-query -Rs '*' | rg -o --pcre2 '(?<=\[-\]\s)[\w-]*(?=-\d+.*)' | fzf -q "$1" -m --preview 'xbps-query -R {1} | bat -p --language yaml --color=always' | xargs -ro sudo xbps-install
|
|
else if set -ql _flag_clean
|
|
sudo xbps-remove -yOo
|
|
else
|
|
echo -e "Usage: fbps [MODE]\n"
|
|
echo "MODE"
|
|
echo -e " -h --help\tShow this help"
|
|
echo -e " -i --install\tInstall a remote package"
|
|
echo -e " -r --remove\tRemove an installed package"
|
|
echo -e " -c --clean\tCleanup old/cached packages"
|
|
return 0
|
|
end
|
|
|
|
end
|