From 534c96ccf4eb90e0e34a884c24a0cc3fc8defa8c Mon Sep 17 00:00:00 2001 From: Eric Lay Date: Mon, 22 Jun 2020 14:43:06 -0500 Subject: [PATCH] work in progress --- fpf | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/fpf b/fpf index 14b6b0f..493a142 100755 --- a/fpf +++ b/fpf @@ -1,7 +1,7 @@ #!/usr/bin/bash ### Set up package lists -pacman -Slq >/dev/null 2>&1 /tmp/packages +pacman -Slq | sort > /tmp/packages ### Help Help() { @@ -24,9 +24,20 @@ Help() { # Test for AUR option, if not run with pacman if [[ -z "$1" ]]; then - pacman -Qq > /tmp/local_packages - cat /tmp/packages /tmp/local_packages | sort | uniq > /tmp/all_packages - cat /tmp/all_packages |fzf -e -m --preview 'cat <(pacman -Si {1}) <(pacman -Fl {1} | awk "{print \$2}")' --layout=reverse --prompt='Select packages to install (use TAB to toggle selection) >' | xargs -ro -n1 sudo pacman -S + echo "Setting things up..." +# echo -e "$(pacman -Qqe)\n" > /tmp/local_packages +# counter=1 +# while IFS= read -r line; do +# sed -i -e '/$line/ s/.*/"$line" */g' /tmp/packages +# counter=$((counter+1)) +# done < /tmp/local_packages + mapfile -t local_pkgs < <(pacman -Qqe) + for line in "${local_pkgs[@]}"; do + sed -i "s/${line}/${line} */" /tmp/packages + done + unset local_pkgs + cat /tmp/packages |fzf -e -m --preview 'cat <(pacman -Si {1}) <(pacman -Fl {1} | awk "{print \$2}")' --layout=reverse --prompt='Select packages to install (use TAB to toggle selection) >' | xargs -ro -n1 sudo pacman -S + clear fi while getopts ":yh" option; do