Skip to content

Instantly share code, notes, and snippets.

@jezdez
Created August 27, 2008 13:47
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 jezdez/7480 to your computer and use it in GitHub Desktop.
Save jezdez/7480 to your computer and use it in GitHub Desktop.
coda shell script. Download that script by clicking on "raw" and save it somewhere on your $PATH as "coda". Then make it executable (chmod +x /path/to/coda).
#!/bin/sh
#
# Shell script to open files or folders with Coda.app
# Based on a script by Wout Mertens and suggestions from Laurent Bihanic.
# The original version is the fault of Benji Fisher, 16 May 2005 (with
# modifications by Nico Weber and Bjorn Winckler, Aug 13 2007). Originally
# released as the "mvim" shell script of MacVim.app.
# First, check "All the Usual Suspects" for the location of the Coda.app
# bundle. You can short-circuit this by setting the CODA_APP_DIR environment
# variable or by un-commenting and editing the following line:
# CODA_APP_DIR=/Applications
if [ -z "$CODA_APP_DIR" ]
then
myDir="`dirname "$0"`"
myAppDir="$myDir/../Applications"
for i in ~/Applications $myDir $myAppDir /Applications /Applications/Utilities; do
if [ -x "$i/Coda.app" ]; then
CODA_APP_DIR="$i"
break
fi
done
fi
if [ -z "$CODA_APP_DIR" ]
then
echo "Sorry, cannot find Coda.app. Try setting the CODA_APP_DIR environment variable to the directory containing Coda.app."
exit 1
fi
binary="$CODA_APP_DIR/Coda.app"
if [ "$1" ]; then
open -a "$binary" ${1:+"$@"}
else
echo "Usage: coda [file ...]"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment