gg 281 B

1234567891011121314151617181920
  1. #!/bin/sh
  2. query="$1"
  3. flag="-n"
  4. if test "$1" = "-n"; then
  5. flag=""
  6. query="$2"
  7. fi
  8. if test "$1" = "+"; then
  9. query="$2"
  10. fi
  11. full=`git grep $flag $query | pick`
  12. file=`echo "$full" | cut -d : -f 1-2`
  13. if test "$1" = "+"; then
  14. echo $file | sed -e "s/:/ +/g"
  15. else
  16. echo "$file"
  17. fi