Skip to content

Instantly share code, notes, and snippets.

@eldargab

eldargab/light Secret

Created January 10, 2014 06:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eldargab/41cd15d3712d7a1cd586 to your computer and use it in GitHub Desktop.
Save eldargab/41cd15d3712d7a1cd586 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ -z "$LT_HOME" ]
then
if [ -L $0 ]; then
myDir="`dirname $(readlink $0)`"
else
myDir=$(dirname $0)
fi
myAppDir="$myDir/../Applications"
for i in ~/Applications ~/Applications/LightTable $myDir $myDir/LightTable $myAppDir $myAppDir/LightTable /Applications /Applications/LightTable /Applications/Utilities /Applications/Utilities/LightTable; do
if [ -x "$i/LightTable.app" ]; then
APP_DIR="$i"
break
fi
done
else
APP_DIR=$LT_HOME
fi
if [ -z "$APP_DIR" ]
then
echo "Sorry, cannot find LightTable.app. Try setting the LT_HOME environment variable to the directory containing LightTable.app."
exit 1
fi
LTAPPCLI=$APP_DIR/LightTable.app/Contents/MacOS/node-webkit
PWD=`pwd`
ARGS="$@"
CORRECTED=${ARGS//-/<d>}
CORRECTED=${CORRECTED// /<s>}
if [ $# != 0 ]; then
LTCLI=true $LTAPPCLI "<d><d>dir=$PWD<s>$CORRECTED" &
else
LTCLI=true $LTAPPCLI &
fi
open -a LightTable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment