Skip to content

Instantly share code, notes, and snippets.

@eyston
Created Oct 2, 2011
Embed
What would you like to do?
FSharp Interactive Textmate Command
EXPR="$(cat | sed 's/\\/\\\\/g' | sed 's/\"/\\\"/g')"
export SHELL_NAME=${SHELL_NAME:="FSharp Interactive"}
export SHELL_INTERPRETER=${SHELL_INTERPRETER:="fsi"}
osascript << END
tell application "Terminal"
activate
set _foundTab to false
repeat with w in windows
tell w
repeat with t in tabs
set c_title to custom title of t
if c_title = "$SHELL_NAME" then
set _foundTab to true
set _window to w
set _tab to t
end if
end repeat
end tell
end repeat
if not _foundTab then
do script "$SHELL_INTERPRETER"
set _window to first window whose frontmost is true
set _tab to selected tab of _window
set custom title of _tab to "$SHELL_NAME"
end if
do script "$EXPR" & ";;" in _tab
set frontmost of _window to true
set selected of _tab to true
end tell
END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment