From 3a91986d11520193e37a1933dd7be0ee6dd1fab0 Mon Sep 17 00:00:00 2001 From: Eric Lay Date: Sat, 13 Jun 2020 15:24:23 -0500 Subject: [PATCH] merged scripts into single command --- PKGBUILD | 2 +- bin/pacfzf | 3 --- bin/yayfzf | 2 -- fpf | 39 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 6 deletions(-) delete mode 100755 bin/pacfzf delete mode 100755 bin/yayfzf create mode 100755 fpf diff --git a/PKGBUILD b/PKGBUILD index 51fa154..31ba94b 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -16,7 +16,7 @@ md5sums=('SKIP') package() { cd "$srcdir" install -dm755 $pkgdir/usr/bin - cp -r $srcdir/$pkgname/bin $pkgdir/usr + cp -r $srcdir/$pkgname/fpf $pkgdir/usr/bin/ chmod a+x $pkgdir/usr/bin/* install -dm755 "$pkgdir"/usr/lib/systemd/system/ install -m644 $srcdir/$pkgname/fpf.{service,timer} "$pkgdir"/usr/lib/systemd/system/ diff --git a/bin/pacfzf b/bin/pacfzf deleted file mode 100755 index 594b484..0000000 --- a/bin/pacfzf +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -pacman -Sl | awk '{print $2($4=="" ? "" : " *")}'| fzf -e -m --preview 'cat <(pacman -Si {1}) <(pacman -Fl {1} | awk "{print \$2}")' --layout=reverse | xargs -ro -n1 sudo pacman -S \ No newline at end of file diff --git a/bin/yayfzf b/bin/yayfzf deleted file mode 100755 index 7da03d5..0000000 --- a/bin/yayfzf +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -yay -Sl | awk '{print $2($4=="" ? "" : " *")}'| fzf -e -m --preview 'cat <(yay -Si {1}) <(yay -Fl {1} | awk "{print \$2}")' --layout=reverse | xargs -ro -n1 yay -S diff --git a/fpf b/fpf new file mode 100755 index 0000000..8021f89 --- /dev/null +++ b/fpf @@ -0,0 +1,39 @@ +#!/usr/bin/bash + + +### Help + +Help() { + echo + echo "Use fzf to search and install with Pacman and Yay" + echo "Defaults to Pacman if no options passed" + echo + echo "Syntax: fpf -[y|h]" + echo + echo "options:" + echo + echo "y Search and install with Yay" + echo + echo "h Print this help screen." + echo + echo +} + +### MAIN + +while getopts ":yh" option; do + case $option in + + y) yay -Sl | awk '{print $2($4=="" ? "" : " *")}'| fzf -e -m --preview 'cat <(yay -Si {1}) <(yay -Fl {1} | awk "{print \$2}")' --layout=reverse | xargs -ro -n1 yay -S + exit;; + + h) Help + exit;; + + \?) echo "Error: Invalid option" + exit;; + + esac +done + +pacman -Sl | awk '{print $2($4=="" ? "" : " *")}'| fzf -e -m --preview 'cat <(pacman -Si {1}) <(pacman -Fl {1} | awk "{print \$2}")' --layout=reverse | xargs -ro -n1 sudo pacman -S