diff options
| -rwxr-xr-x | gist | 15 |
1 files changed, 14 insertions, 1 deletions
| @@ -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 |