Skip to content

Commit

Permalink
Rough concept that can remove/install packages
Browse files Browse the repository at this point in the history
  • Loading branch information
zdykstra committed Aug 11, 2020
0 parents commit fd57d77
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions fuzzypkg
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/env bash

selected="$(
xbps-query -R --search= \
| sed -Er "s/(\[\*\].*)/$( printf "\033[0;32m" )\1$( printf "\033[0m" )/"\
| fzf \
--prompt "Package name >" \
--layout=reverse \
--cycle \
-n 2.. \
--preview="xq {2}" \
--preview-window=down:wrap \
--ansi -e -m \
)"
while read -r line; do
if discard="$(echo "${line}" | grep -q "\[\*\]")"; then
UNINSTALL="$UNINSTALL$( echo ${line} | awk '{ print $2 }' ) "
else
INSTALL="$INSTALL$( echo ${line} | awk '{ print $2 }' ) "
fi
done <<<"${selected}"
clear
if [ ! -z ${UNINSTALL} ]; then
echo "Executing xbps-remove -R ${UNINSTALL}"
xbps-remove -R ${UNINSTALL}
fi
if [ ! -z ${INSTALL} ]; then
echo "Executing xbps-install -Rs ${INSTALL}"
xbps-install -Rs ${INSTALL}
fi

0 comments on commit fd57d77

Please sign in to comment.