aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xgist15
1 files changed, 14 insertions, 1 deletions
diff --git a/gist b/gist
index a85e826..4ee4ecd 100755
--- a/gist
+++ b/gist
@@ -276,7 +276,20 @@ _show_list() {
276 276
277# TODO support filenames, file contents 277# TODO support filenames, file contents
278_grep_content() { 278_grep_content() {
279 hint=false mark=. _show_list | grep -Ei "^ *[^ ]+ [^ ]+ .*$1.*" 279 while read -r index url _ _ _ _ _ _ description; do
280 if grep --color=always -iq "$1" <<<"$description"; then
281 hint=false mark="$index " _show_list | grep --color=always -Ei "$1"
282 else
283 repo=$folder/$(echo $url | sed -E -e 's#.*/##')
284 [[ -d $repo ]] && cd $repo || continue
285 file=$(ls $repo | grep --color=always -Ei "$1")
286 content=$(grep --color=always -EHi "$1" * | head -1)
287
288 [[ -n $file && file="$file\n" || -n $content ]] \
289 && hint=false mark="$index " _show_list \
290 && echo -e "$file$content\n" | sed -e 's/^/ /'
291 fi
292 done < $INDEX
280} 293}
281 294
282# Open Github repository import page 295# Open Github repository import page