From ae0145c0d2127758c12b70a13067e4d3b0cdb7a6 Mon Sep 17 00:00:00 2001 From: Seppia Date: Sun, 3 Jun 2018 02:15:00 +0200 Subject: Installed mark fix Fixed math for installed packages in the search function. --- repo.sh | 5 +++-- 1 file 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() { -- cgit v1.2.3