Compare commits

...

5 Commits

Author SHA1 Message Date
ericlay e192e57306 small logical update 2023-04-18 19:48:55 -05:00
Eric Lay 462c15b61b working on keybindings 2023-04-05 19:34:30 -05:00
ericlay bbe6a10f95 added keybinds help 2023-04-05 14:00:44 -05:00
Eric Lay 3f606eeec9 theme colors 2023-04-05 17:17:54 -05:00
Eric Lay 8900ca84b9 launching personal branch for customized version 2023-04-04 17:26:16 -05:00
1 changed files with 28 additions and 16 deletions

44
fpf
View File

@ -5,14 +5,17 @@ Help() {
echo -e "\nUse fzf to search and install with Pacman and Yay"
echo -e "Defaults to Pacman if no options passed\n"
echo -e "SYNTAX\n\tfpf [-a| --aur] [-l| --list-installed] [-la| --list-aur-installed]\n\t\t[R| --remove] [-o| --orphans] [-h | --help]\n"
echo -e "EXAMPLE\n\tfpf [pkg name] for official repo search\n\tfpf-a [pkg name] for aur search\n"
echo -e "EXAMPLE\n\tfpf [pkg name] for official repo search\n\tfpf -a [pkg name] for aur search\n"
echo -e "OPTIONS"
echo -e "\t-a, --aur\n\t\tSearch/List and install from AUR with Yay\n"
echo -e "\t-l, --list-installed\n\t\tSearch/List installed packages from official repo\n"
echo -e "\t-la, --list-aur-installed\n\t\tSearch/List installed packages from AUR\n"
echo -e "\t-R, -remove\n\t\tSearch/List installed packages for removal\n"
echo -e "\t-o, --orphans\n\t\tSearch/List orphaned packages for removal\n"
echo -e "\t-h, --help\n\t\tPrint this help screen\n"
echo -e "\t-h, --help\n\t\tPrint this help screen"
echo -e "KEYBINDS"
echo -e " GLOBAL\n\tctrl-h\tShows this help text in preview window\n\tctrl-r\tClears previously selected pkg's from list\n\tctrl-x\tReturns preview window to default view\n"
echo -e " AUR\n\tctrl-p\tShows PKGBUILD in preview window\n"
}
# Check things are up to date
@ -32,9 +35,7 @@ UpdateAurInfos() {
jq --compact-output '.[] |
{ Name, Description } ' |
awk -F'"' '{ printf "%-20s\t%s\n", $4, $8}' > /tmp/aur/packages-meta
while IFS= read -r pkgName; do
grep -w "^$pkgName " /tmp/aur/packages-meta >> /tmp/aur/installed
done < <(pacman -Qqm)
parallel grep -w "^{} " /tmp/aur/packages-meta ">>" /tmp/aur/installed < <(pacman -Qqm)
sort <(comm -23 <(cat /tmp/aur/packages-meta | sort) <( cat /tmp/aur/installed | sort)) <(comm -12 <( cat /tmp/aur/packages-meta | sort) <(cat /tmp/aur/installed | sort) | awk -F"\t" '{print $1" \033[32m*\033[0m ", $2}') -o /tmp/aur/packages-meta
}
@ -58,19 +59,23 @@ fi
# Get Official package list, sort, mark installed, preview infos and finally hand off to pacman for install
Official() {
echo "Setting things up..."
sort <(comm -23 <(expac -S '%-20n\t%d' | sort) <(expac '%-20n\t%d' | sort)) <(comm -12 <(expac -S '%-20n\t%d' | sort) <(expac '%-20n\t%d' | sort) | awk -F"\t" '{print $1"\033[32m*\033[0m ", $2}') &>/dev/null > /tmp/packages
sort <(comm -23 <(expac -S '%-20n\t%d' | sort) <(expac '%-20n\t%d' | sort)) <(comm -12 <(expac -S '%-20n\t%d' | sort) <(expac '%-20n\t%d' | sort) | awk -F"\t" '{print $1"\033[36m*\033[0m ", $2}') &>/dev/null > /tmp/packages
cat /tmp/packages |
fzf -q "$1" -e -m \
--preview='cat <(pacman -Si {1}) <(pacman -Fl {1} | awk "{print \$2}")' \
--preview-window=55%:wrap:border-sharp \
--preview-label="| Package Information |" \
--preview-window=55%:wrap:border-rounded \
--layout=reverse \
--marker='>>' \
--marker='✔ ' \
--prompt=' ' \
--pointer='󰧚 ' \
--header="$(echo -e ' Select packages to install\n (use TAB to toggle selection)\n')" \
--info=hidden \
--no-scrollbar \
--ansi \
--color='fg+:15,fg:42,preview-fg:123,preview-label:123,hl+:134,hl:123,query:134,gutter:0,border:134,prompt:15,pointer:15,marker:15,header:123' \
--margin="2%,1%,2%,1%" \
--cycle \
--bind 'focus:transform-preview-label:echo [ {1} ]' \
--tiebreak=begin,chunk,length |
awk '{print $1}' |
sed -e 's/\*$//' |
@ -86,7 +91,7 @@ Installed() {
--preview='cat <(pacman -Qik {1}) <(echo "") <(pacman -Fl {1} | awk "{print \$2}")' \
--preview-window=65%:wrap \
--layout=reverse \
--marker='>>' \
--marker='' \
--header-lines=2 \
--info=hidden \
--ansi \
@ -101,10 +106,10 @@ Remove() {
echo "$(echo -e ' Select packages to remove\n (use TAB to toggle selection)'; cat /tmp/installed_packages)" > /tmp/installed_packages
cat /tmp/installed_packages |
fzf -q "$1" -e -m \
--preview='cat <(pacman -Si {1} 2>/dev/null || yay -Qi {1} 2>/dev/null || paru -Qi {1}) <(pacman -Ql {1} | awk "{print \$2}")' \
--preview='bat <(pacman -Si {1} 2>/dev/null || yay -Qi {1} 2>/dev/null || paru -Qi {1}) <(pacman -Ql {1} | awk "{print \$2}")' \
--preview-window=65%:wrap \
--layout=reverse \
--marker='>>' \
--marker='' \
--header-lines=2 \
--info=hidden \
--ansi \
@ -123,16 +128,23 @@ Aur() {
[[ "${d2///-/}" > "${d1//-/}" ]] && UpdateAurInfos
cat /tmp/aur/packages-meta |
fzf -q "$1" -e -m \
--preview='cat <(yay -Si {1} 2>/dev/null || paru -Si {1}) <(pacman -Ql {1} 2>/dev/null | awk "{print \$2}")' \
--preview='bat <(yay -Si {1} 2>/dev/null || paru -Si {1}) <(pacman -Ql {1} 2>/dev/null | awk "{print \$2}")' \
--preview-window=55%:wrap:border-sharp \
--layout=reverse \
--marker='>>' \
--marker='✔ ' \
--prompt=' ' \
--pointer='󰧚 ' \
--header="$(echo -e ' Select packages to install\n (use TAB to toggle selection)\n')" \
--info=hidden \
--no-scrollbar \
--ansi \
--color='fg+:15,fg:42,preview-fg:123,preview-label:123,hl+:134,hl:123,query:134,gutter:0,border:134,prompt:15,pointer:15,marker:15,header:123' \
--margin="2%,1%,2%,1%" \
--cycle \
--tiebreak=begin,chunk,length \
--bind 'focus:transform-preview-label:echo [ {1} ]' \
--bind=ctrl-h:preview:'/home/ez/Git/fuzzy-pkg-finder/fpf -h' \
--bind=ctrl-r:clear-selection \
--bind=ctrl-p:preview:'curl --silent https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD\?h={1}' \
--bind=ctrl-x:preview:'cat <(yay -Si {1} 2>/dev/null || paru -Si {1}) <(pacman -Ql {1} 2>/dev/null | awk "{print \$2}")' |
awk '{print $1}' |
@ -149,7 +161,7 @@ AurInstalled() {
--preview 'cat <(pacman -Qik {1}) <(echo "") <(pacman -Ql {1} | awk "{print \$2}")' \
--preview-window=65%:wrap \
--layout=reverse \
--marker='>>' \
--marker='' \
--header-lines=2 \
--info=hidden \
--ansi \
@ -170,7 +182,7 @@ Orphans() {
--preview='cat <(pacman -Qik {1} 2>/dev/null || yay -Qi {1} 2>/dev/null || paru -Qi {1}) <(pacman -Ql {1} | awk "{print \$2}")' \
--preview-window=65%:wrap \
--layout=reverse \
--marker='>>' \
--marker='' \
--header-lines=2 \
--info=hidden \
--ansi \