-
-
Save mattryall/1403829 to your computer and use it in GitHub Desktop.
Shell script to launch IDEA
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/sh | |
# grab the latest version of IDEA | |
IDEA=`ls -1dt /Applications/IntelliJ\ * | head -n1` | |
if [ -f "$1" ]; then # first, try any filename provided | |
open -a "$IDEA" "$1" | |
elif [ -d ".idea" ]; then # second, try the .idea directory | |
open -a "$IDEA" "." | |
elif [ -f *.ipr ]; then # third, try any IDEA project files | |
open -a "$IDEA" `ls -1d *.ipr | head -n1` | |
elif [ -f pom.xml ]; then # fourth, try importing pom.xml | |
open -a "$IDEA" pom.xml | |
else # finally, just open IDEA | |
open "$IDEA" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment