summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeppia <seppia@seppia.net>2018-06-11 13:31:37 +0200
committerSeppia <seppia@seppia.net>2018-06-11 13:31:37 +0200
commitd5347710cc0a3d0f65c5a601e72fe021a28b3eef (patch)
tree7236e8cc746359f503e925fda06da8d0774f474b
parent47fc2f8db09f101d0b65046547972126849bcde9 (diff)
downloadrepofish-d5347710cc0a3d0f65c5a601e72fe021a28b3eef.tar.gz
repofish-d5347710cc0a3d0f65c5a601e72fe021a28b3eef.tar.bz2
repofish-d5347710cc0a3d0f65c5a601e72fe021a28b3eef.zip
Bug fix and easter egg
Fixes a bug happening when searching for packages and local list is empty. It also introduces an easter egg. When local packages list is empty and the function shouldn't match anything as locally installed, there is now the chance of it matching a random string of 15 characters consisting in numbers and/or capital letters. It is higly unlikely and should do no harm, but still remains funny.
-rwxr-xr-xrepofish3
1 files changed, 3 insertions, 0 deletions
diff --git a/repofish b/repofish
index 3fcdc33..8835a2d 100755
--- a/repofish
+++ b/repofish
@@ -181,6 +181,9 @@ archive_repo_packages() {
search_packages() {
declare -a key=("${!1}")
LIST_INST=$($0 list | tail -n +2 | tr '\n' '|')
+ if [ "$LIST_INST" == '' ]; then
+ LIST_INST=$(head -c 9 /dev/urandom | base32)
+ fi
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' \