Skip to content

Instantly share code, notes, and snippets.

@dillonhafer
Created July 8, 2024 14:49
Show Gist options
  • Save dillonhafer/043c2eaa7befe6b92dcb6205a3afdd4c to your computer and use it in GitHub Desktop.
Save dillonhafer/043c2eaa7befe6b92dcb6205a3afdd4c to your computer and use it in GitHub Desktop.
iTerm2 script to open vite and rails server
#!/usr/bin/osascript
on run argv
set project to (do shell script "pwd")
tell application "iTerm2"
tell current window
tell current session
write text "clear; cd " & project
set serverTab to (split vertically with default profile)
tell serverTab to write text "cd " & project & "; (test -f config/application.rb && rails server) || exit"
tell serverTab
set viteTab to (split horizontally with default profile)
tell viteTab to write text "cd " & project & "; (test -f vite.config* && vite dev) || exit"
end tell
write text "code ."
end tell
end tell
end tell
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment