Skip to content

Instantly share code, notes, and snippets.

@psrpinto
Last active July 26, 2021 12:28
Show Gist options
  • Save psrpinto/b3787bae212d5d99649b517e2efd4dce to your computer and use it in GitHub Desktop.
Save psrpinto/b3787bae212d5d99649b517e2efd4dce to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# This script requires GNU grep, which on macOS can be installed with: brew install grep
# GNU grep will then be available through the ggrep command, which is used in this script.
set -eux
#DIRECTORIES="matrix-js-sdk matrix-react-sdk element-web"
#DIRECTORIES="element-android element-ios matrix-ios-kit"
DIRECTORIES="element-ios matrix-ios-kit"
PATTERNS=(
'Home\ Server'
'Home\ server'
'home\ Server'
'home\ server'
#'HomeServer'
'Identity\ Server'
'(?<!["|'"'"'|>])Identity\ server' # When not at preceded by ",' or >, i.e. not at beginning of string
'identity\ Server'
'ID\ [S|s]erver'
'[I|i]ntegrations [M|m]anager'
'Integs'
'Integration Manager'
'(?<!["|'"'"'|>])Integration\ manager' # When not at preceded by ",' or >, i.e. not at beginning of string
)
# Join patterns into a single one, separated by |
PATTERN=$(IFS=\| ; echo "${PATTERNS[*]}")
find $DIRECTORIES \
-not -path "*/node_modules/*" \
-not -path "*/.git/*" \
-not -path "element-web/webapp/*" \
-not -path "*CHANGELOG*" \
-not -path "*CHANGES.md*" \
-not -path "*CHANGES.rst*" \
-type f \
-print0 |
xargs -0 ggrep --perl-regexp --line-number --color=auto "$PATTERN"
# -not -path "*strings.xml*" \
# -not -path "*Vector.strings*" \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment