Compare commits
5 Commits
Author | SHA1 | Date |
---|---|---|
ericlay | e192e57306 | |
Eric Lay | 462c15b61b | |
ericlay | bbe6a10f95 | |
Eric Lay | 3f606eeec9 | |
Eric Lay | 8900ca84b9 |
44
fpf
44
fpf
|
@ -5,14 +5,17 @@ Help() {
|
||||||
echo -e "\nUse fzf to search and install with Pacman and Yay"
|
echo -e "\nUse fzf to search and install with Pacman and Yay"
|
||||||
echo -e "Defaults to Pacman if no options passed\n"
|
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 "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 "OPTIONS"
|
||||||
echo -e "\t-a, --aur\n\t\tSearch/List and install from AUR with Yay\n"
|
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-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-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-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-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
|
# Check things are up to date
|
||||||
|
@ -32,9 +35,7 @@ UpdateAurInfos() {
|
||||||
jq --compact-output '.[] |
|
jq --compact-output '.[] |
|
||||||
{ Name, Description } ' |
|
{ Name, Description } ' |
|
||||||
awk -F'"' '{ printf "%-20s\t%s\n", $4, $8}' > /tmp/aur/packages-meta
|
awk -F'"' '{ printf "%-20s\t%s\n", $4, $8}' > /tmp/aur/packages-meta
|
||||||
while IFS= read -r pkgName; do
|
parallel grep -w "^{} " /tmp/aur/packages-meta ">>" /tmp/aur/installed < <(pacman -Qqm)
|
||||||
grep -w "^$pkgName " /tmp/aur/packages-meta >> /tmp/aur/installed
|
|
||||||
done < <(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
|
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
|
# Get Official package list, sort, mark installed, preview infos and finally hand off to pacman for install
|
||||||
Official() {
|
Official() {
|
||||||
echo "Setting things up..."
|
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 |
|
cat /tmp/packages |
|
||||||
fzf -q "$1" -e -m \
|
fzf -q "$1" -e -m \
|
||||||
--preview='cat <(pacman -Si {1}) <(pacman -Fl {1} | awk "{print \$2}")' \
|
--preview='cat <(pacman -Si {1}) <(pacman -Fl {1} | awk "{print \$2}")' \
|
||||||
--preview-window=55%:wrap:border-sharp \
|
--preview-window=55%:wrap:border-rounded \
|
||||||
--preview-label="| Package Information |" \
|
|
||||||
--layout=reverse \
|
--layout=reverse \
|
||||||
--marker='>>' \
|
--marker='✔ ' \
|
||||||
|
--prompt=' ' \
|
||||||
|
--pointer=' ' \
|
||||||
--header="$(echo -e ' Select packages to install\n (use TAB to toggle selection)\n')" \
|
--header="$(echo -e ' Select packages to install\n (use TAB to toggle selection)\n')" \
|
||||||
--info=hidden \
|
--info=hidden \
|
||||||
|
--no-scrollbar \
|
||||||
--ansi \
|
--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%" \
|
--margin="2%,1%,2%,1%" \
|
||||||
--cycle \
|
--cycle \
|
||||||
|
--bind 'focus:transform-preview-label:echo [ {1} ]' \
|
||||||
--tiebreak=begin,chunk,length |
|
--tiebreak=begin,chunk,length |
|
||||||
awk '{print $1}' |
|
awk '{print $1}' |
|
||||||
sed -e 's/\*$//' |
|
sed -e 's/\*$//' |
|
||||||
|
@ -86,7 +91,7 @@ Installed() {
|
||||||
--preview='cat <(pacman -Qik {1}) <(echo "") <(pacman -Fl {1} | awk "{print \$2}")' \
|
--preview='cat <(pacman -Qik {1}) <(echo "") <(pacman -Fl {1} | awk "{print \$2}")' \
|
||||||
--preview-window=65%:wrap \
|
--preview-window=65%:wrap \
|
||||||
--layout=reverse \
|
--layout=reverse \
|
||||||
--marker='>>' \
|
--marker='✔ ' \
|
||||||
--header-lines=2 \
|
--header-lines=2 \
|
||||||
--info=hidden \
|
--info=hidden \
|
||||||
--ansi \
|
--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
|
echo "$(echo -e ' Select packages to remove\n (use TAB to toggle selection)'; cat /tmp/installed_packages)" > /tmp/installed_packages
|
||||||
cat /tmp/installed_packages |
|
cat /tmp/installed_packages |
|
||||||
fzf -q "$1" -e -m \
|
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 \
|
--preview-window=65%:wrap \
|
||||||
--layout=reverse \
|
--layout=reverse \
|
||||||
--marker='>>' \
|
--marker='✔ ' \
|
||||||
--header-lines=2 \
|
--header-lines=2 \
|
||||||
--info=hidden \
|
--info=hidden \
|
||||||
--ansi \
|
--ansi \
|
||||||
|
@ -123,16 +128,23 @@ Aur() {
|
||||||
[[ "${d2///-/}" > "${d1//-/}" ]] && UpdateAurInfos
|
[[ "${d2///-/}" > "${d1//-/}" ]] && UpdateAurInfos
|
||||||
cat /tmp/aur/packages-meta |
|
cat /tmp/aur/packages-meta |
|
||||||
fzf -q "$1" -e -m \
|
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 \
|
--preview-window=55%:wrap:border-sharp \
|
||||||
--layout=reverse \
|
--layout=reverse \
|
||||||
--marker='>>' \
|
--marker='✔ ' \
|
||||||
|
--prompt=' ' \
|
||||||
|
--pointer=' ' \
|
||||||
--header="$(echo -e ' Select packages to install\n (use TAB to toggle selection)\n')" \
|
--header="$(echo -e ' Select packages to install\n (use TAB to toggle selection)\n')" \
|
||||||
--info=hidden \
|
--info=hidden \
|
||||||
|
--no-scrollbar \
|
||||||
--ansi \
|
--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%" \
|
--margin="2%,1%,2%,1%" \
|
||||||
--cycle \
|
--cycle \
|
||||||
--tiebreak=begin,chunk,length \
|
--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-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}")' |
|
--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}' |
|
awk '{print $1}' |
|
||||||
|
@ -149,7 +161,7 @@ AurInstalled() {
|
||||||
--preview 'cat <(pacman -Qik {1}) <(echo "") <(pacman -Ql {1} | awk "{print \$2}")' \
|
--preview 'cat <(pacman -Qik {1}) <(echo "") <(pacman -Ql {1} | awk "{print \$2}")' \
|
||||||
--preview-window=65%:wrap \
|
--preview-window=65%:wrap \
|
||||||
--layout=reverse \
|
--layout=reverse \
|
||||||
--marker='>>' \
|
--marker='✔ ' \
|
||||||
--header-lines=2 \
|
--header-lines=2 \
|
||||||
--info=hidden \
|
--info=hidden \
|
||||||
--ansi \
|
--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='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 \
|
--preview-window=65%:wrap \
|
||||||
--layout=reverse \
|
--layout=reverse \
|
||||||
--marker='>>' \
|
--marker='✔ ' \
|
||||||
--header-lines=2 \
|
--header-lines=2 \
|
||||||
--info=hidden \
|
--info=hidden \
|
||||||
--ansi \
|
--ansi \
|
||||||
|
|
Loading…
Reference in New Issue