-
-
Save abhiomkar/344807 to your computer and use it in GitHub Desktop.
Simple shell script that locates a Python module and opens it in your default editor.
This file contains 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
#!/bin/bash | |
# forked from gist:320305 by mmalone | |
if [ $# -ne 1 ]; then | |
echo "Usage: pyedit <python module>" | |
exit 1 | |
fi | |
MODULE_LOCATION=`python -c "import $1; print $1.__file__.rstrip('c')"` | |
if [ -z $MODULE_LOCATION ]; then | |
echo "Couldn't find module: $1" | |
exit 1 | |
fi | |
if [ -z $EDITOR ] | |
EDITOR = "vi" | |
$EDITOR $MODULE_LOCATION |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment