diff options
-rwxr-xr-x | search_repo | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/search_repo b/search_repo index 0f4f42c..ed9562d 100755 --- a/search_repo +++ b/search_repo @@ -15,16 +15,25 @@ shift WORDS="$@" query=$(echo "$WORDS" | sed -E 's/\ /\|/g') -echo "$query" cd "$FOLDER" -repos=$(find ./ -type d | grep -E "\/.*\/" | grep -Ei "$query" | \ +reponames=$(find ./ -type d | grep -E "\/.*\/" | grep -Ei "$query" | \ sed -E 's/.\/([a-z]+)\//\1:\/\//1') -res=$(grep -Eric "$query" | grep -v ":0$" | sort -t ':' -rnk2 | \ - sed -E 's/([a-z]+)\//\1:\/\//1;s/\/[^\/]*$//' ) +descrfiles=$(find ./ -type f -name 'DESCR' | tr '\n' ' ') +repodescr=$(grep -Eic "$query" ${descrfiles} | grep -v ":0$" | sort -t ':' -rnk2 | \ + sed -E 's/^\.\///;s/([a-z]+)\//\1:\/\//1;s/\/[^\/]*$//' ) -echo "$repos" | grep -Ei "^[a-z]+://" -echo "--" >&2 -echo "$res" | grep -Ei "^[a-z]+://" + +readmefiles=$(find ./ -type f -iname 'readme*' | tr '\n' ' ') +readmes=$(grep -Eic "$query" ${readmefiles} | grep -v ":0$" | sort -t ':' -rnk2 | \ + sed -E 's/^\.\///;s/([a-z]+)\//\1:\/\//1;s/\/[^\/]*$//' ) + + +echo "--URL" >&2 +echo "$reponames" | grep -Ei "^[a-z]+://" +echo "--DESCR" >&2 +echo "$repodescr" | grep -Ei "^[a-z]+://" +echo "--README" >&2 +echo "$readmes" | grep -Ei "^[a-z]+://" |