summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeppia <seppia@seppia.net>2018-06-03 02:15:00 +0200
committerSeppia <seppia@seppia.net>2018-06-03 02:15:00 +0200
commitae0145c0d2127758c12b70a13067e4d3b0cdb7a6 (patch)
tree2186f869c760a2a582aaccb5c90769e20e092c64
parent82c1fdb5814eb0f393fd79012745929fa7fed3f0 (diff)
downloadrepofish-ae0145c0d2127758c12b70a13067e4d3b0cdb7a6.tar.gz
repofish-ae0145c0d2127758c12b70a13067e4d3b0cdb7a6.tar.bz2
repofish-ae0145c0d2127758c12b70a13067e4d3b0cdb7a6.zip
Installed mark fix
Fixed math for installed packages in the search function.
-rwxr-xr-xrepo.sh5
1 files changed, 3 insertions, 2 deletions
diff --git a/repo.sh b/repo.sh
index 651aa8e..1186d2b 100755
--- a/repo.sh
+++ b/repo.sh
@@ -106,6 +106,7 @@ update_repo() {
search_packages() {
declare -a key=("${!1}")
+ LIST_INST=$($0 list | tr '\n' '|')
CURL_JSN=$(curl -s $(echo ${URL_PREFIX}${SEARCH_STR}"${key[@]}" | sed -e 's/ /+/g'))
OUT_STR=$(jq -r '.results | .[] | [.Name, .Version], .Description' <<< ${CURL_JSN})
SEARCH_OUT=$(sed -e 's/\\//g' -e 's/\[/\\033\[1\;36m\[/g' -e 's/",/\\033\[1\;33m", \[\\033\[1\;32m/g' \
@@ -113,8 +114,8 @@ search_packages() {
printf 'You searched using the following keywords (matching package name and/or description): "'
printf '%s ' "${key[@]}"
printf '\b"\n'
- echo -e ${SEARCH_OUT} | sed -e 's/\[ /\n/g' -e 's/ *\] /\n\t/g' -e 's/", / /g' -e 's/"//g' | for i in $($0 list); do
- sed '/'"$i"'[^-]/ s/$/ '"$(echo -e \\033\[1\;35m[ Installed ]\\033\[1\;37m)"'/'; done
+ echo -e ${SEARCH_OUT} | sed -e 's/\[ /\n/g' -e 's/ *\] /\n\t/g' -e 's/", / /g' -e 's/"//g' | \
+ sed -E '/'"${LIST_INST::-1}"'[^-]/ s/$/ '"$(echo -e \\033\[1\;35m[ Installed ]\\033\[1\;37m)"'/'
}
set_variables() {