From 2874ad80fb5bef5d3d85644704e2a58de1c3cac0 Mon Sep 17 00:00:00 2001
From: Robert Lange <robert.lange@uni-leipzig.de>
Date: Wed, 7 Jun 2023 10:45:17 +0200
Subject: [PATCH] [finc] extend devops find-file.sh to search for strings in
 files across instances

---
 devops/find-file.sh | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/devops/find-file.sh b/devops/find-file.sh
index 4d2634ae88c..0f52e0600a3 100755
--- a/devops/find-file.sh
+++ b/devops/find-file.sh
@@ -19,15 +19,23 @@
 Help()
 {
    # Display Help
+   echo "---------------------------------------------"
    echo "This script looks for occurences of files on finc instance branches. Usage: find-file.sh [file name]"
-   echo "Example: \"./devops/find-file.sh myresearch/edit.phtml\""
+   echo "Example: \"./devops/find-file.sh myresearch/edit.phtml"
+   echo "---------------------------------------------"
+   echo "To find files CONTAINING a certain string set option c. Usage: find-file.sh -c [search string]"
+   echo "Example: \"./devops/find-file.sh -c loanHistoryAction"
+   echo "---------------------------------------------"
 }
 
-while getopts ":h" option; do
+while getopts ":ch" option; do
    case $option in
-      h) # display Help
+      h) echo "display Help..."
          Help
          exit;;
+      c) echo "looking for files containin a string..."
+         git branch --list *instance* | tr -d \* | tr -d '+'| xargs git grep $2
+         exit;;
      \?) # incorrect option
          echo "Error: Invalid option"
          exit 1;
-- 
GitLab