summaryrefslogtreecommitdiff
path: root/search_repo
diff options
context:
space:
mode:
authorKatolaZ <[email protected]>2020-01-10 06:40:53 +0000
committerKatolaZ <[email protected]>2020-01-10 06:40:53 +0000
commitf6b0bad77154ee0e8faddab1c41b909f3eca746f (patch)
treee629aee00bda240711b296182bf516194fc0f45a /search_repo
parent5bd5eae1db07ada543c5ecacb6069b539958bd33 (diff)
change output of search_repo
Diffstat (limited to 'search_repo')
-rwxr-xr-xsearch_repo23
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]+://"