Last active
March 23, 2017 20:52
-
-
Save scriptype/d204e25ce58a90688d9531c77929f57f to your computer and use it in GitHub Desktop.
Find module names where the given term is being `import`ed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Needs useof.sh to work (https://gist.github.com/scriptype/96c2cb131ddfc9080128a52d5e633c58) | |
function importof { | |
if [[ -n $1 ]] | |
then | |
if [[ -n $2 ]] | |
then | |
local dir=$2; | |
else | |
local dir="."; | |
fi | |
useof "import\s\+\?\({\s\+\)$1\?\(.\+\)\?\(\s\+}\s\+\)from" $dir | |
else | |
echo 'Usage: importof <term> <dir>[optional]' | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment