diff options
author | Seppia <seppia@seppia.net> | 2018-06-02 19:08:31 +0200 |
---|---|---|
committer | Seppia <seppia@seppia.net> | 2018-06-02 19:08:31 +0200 |
commit | 82c1fdb5814eb0f393fd79012745929fa7fed3f0 (patch) | |
tree | 420fda1b0534c1ff6ffc54e265c260f0dd5679b9 | |
parent | 19d76f4e6f685c542e475a55f0b9187b151e35d0 (diff) | |
download | repofish-82c1fdb5814eb0f393fd79012745929fa7fed3f0.tar.gz repofish-82c1fdb5814eb0f393fd79012745929fa7fed3f0.tar.bz2 repofish-82c1fdb5814eb0f393fd79012745929fa7fed3f0.zip |
Color support and initial installed package info
Added support for colored output in search mode and mark packages
already present locally.
-rwxr-xr-x | repo.sh | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -108,10 +108,13 @@ search_packages() { declare -a key=("${!1}") 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' \ + -e 's/\]/\\033\[1\;33m\]\\033\[1\;37m\]/g' <<< ${OUT_STR}) printf 'You searched using the following keywords (matching package name and/or description): "' printf '%s ' "${key[@]}" printf '\b"\n' - echo ${OUT_STR} | sed -e 's/\[ /\n/g' -e 's/ *\] /\n\t/g' -e 's/"*, /\//g' -e 's/"//g' + 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 } set_variables() { |