Send commitlog mailing list submissions to
        commitlog@lists.openmoko.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.openmoko.org/mailman/listinfo/commitlog
or, via email, send a message with subject or body 'help' to
        commitlog-requ...@lists.openmoko.org

You can reach the person managing the list at
        commitlog-ow...@lists.openmoko.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of commitlog digest..."
Today's Topics:

   1. r4888 - developers/werner/bin (wer...@docs.openmoko.org)
--- Begin Message ---
Author: werner
Date: 2009-01-15 01:21:55 +0100 (Thu, 15 Jan 2009)
New Revision: 4888

Added:
   developers/werner/bin/gg
Log:
Run a vi search on the files found with git grep.



Added: developers/werner/bin/gg
===================================================================
--- developers/werner/bin/gg                            (rev 0)
+++ developers/werner/bin/gg    2009-01-15 00:21:55 UTC (rev 4888)
@@ -0,0 +1,29 @@
+#!/bin/sh
+#
+# git grep through a tree, list the hits, then set up vi to go through the
+# files we found, searching for the expression.
+#
+# usage: gg [grep_options] search_expression
+#
+
+nondash()
+{
+    while [ ! -z "$*" ]; do
+       if [ "${1#-}" = "$1" ]; then
+           echo "$1"
+           return
+       fi
+       shift
+    done
+}
+
+#
+# the "cat" here serves two purposes:
+# 1) keep "git grep" from truncating long lines
+# 2) keep "git grep" from using a pager, which would result in waiting twice
+#    for user input at the end, which is confusing
+#
+git grep "$@" | cat
+echo -n '[Enter to vi] '
+read x
+vi -c /"`nondash \"$...@\"`" `git grep -l "$@"`


Property changes on: developers/werner/bin/gg
___________________________________________________________________
Name: svn:executable
   + *




--- End Message ---
_______________________________________________
commitlog mailing list
commitlog@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/commitlog

Reply via email to