aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xgist6
1 files changed, 3 insertions, 3 deletions
diff --git a/gist b/gist
index daf57ad..789ef85 100755
--- a/gist
+++ b/gist
@@ -327,20 +327,20 @@ _grep_content() {
327 # grep from description 327 # grep from description
328 local hashtags="$(_hashtags "$description")" 328 local hashtags="$(_hashtags "$description")"
329 if grep --color=always -iq "$1" <<<"${description%% $hashtags}"; then 329 if grep --color=always -iq "$1" <<<"${description%% $hashtags}"; then
330 hint=false mark="$index " _show_list | grep --color=always -Ei "$1" 330 hint=false mark="$index " _show_list
331 else 331 else
332 local repo=$folder/${url##*/} 332 local repo=$folder/${url##*/}
333 [[ -d $repo ]] && cd $repo || continue 333 [[ -d $repo ]] && cd $repo || continue
334 # grep from filenames 334 # grep from filenames
335 local file=$(ls $repo | grep --color=always -Ei "$1") 335 local file=$(ls $repo | grep --color=always -Ei "$1")
336 # grep from content of files 336 # grep from content of files
337 local content=$(grep --color=always -EHi "$1" * | head -1) 337 local content=$(grep --color=always -EHi -m1 "$1" *)
338 338
339 [[ -n $file && file="$file\n" || -n $content ]] \ 339 [[ -n $file && file="$file\n" || -n $content ]] \
340 && hint=false mark="$index " _show_list \ 340 && hint=false mark="$index " _show_list \
341 && echo -e " $file$content" 341 && echo -e " $file$content"
342 fi 342 fi
343 done 343 done | grep --color=always -Ei -C1 "$1"
344} 344}
345 345
346# Parse JSON object of the result of gist fetch 346# Parse JSON object of the result of gist fetch