]> ToastFreeware Gitweb - gregoa/movein.git/blobdiff - movein
Add "locate" command to movein
[gregoa/movein.git] / movein
diff --git a/movein b/movein
index 20c71efbd20083fb1c0474e50b3dc3ac4cf3a1ff..8030ee318869aeee1b6c13561cca5c9551712bbd 100755 (executable)
--- a/movein
+++ b/movein
@@ -53,6 +53,9 @@ COMMANDS
   list-remote
       show a list of remote repositories
 
+  locate pattern
+      locate which repositories contain files matching pattern
+
   add repository_name
       checkout one or more repositories from the remote host and add it to
       mr's configuration
@@ -206,6 +209,13 @@ listremote() {
     " </dev/null
 }
 
+locate() {
+    local REPO
+    for REPO in $($0 list); do
+      (cd /; $0 exec "$REPO" git ls-files | sed -nr "/$1/{s/^/$REPO:/p}")
+    done
+}
+
 new() {
     if [ $# -lt 2 ]; then 
        usage
@@ -280,6 +290,9 @@ case "$command" in
     list-remote)
        listremote
        ;;
+    locate)
+       locate "$@"
+       ;;
 
     *)
        usage