Last active
December 2, 2021 08:18
-
-
Save vuchau/e977bc1934984e8e859b8ddd8ddd3b38 to your computer and use it in GitHub Desktop.
SmartGit Hg with iTerm2 v3
This file contains hidden or 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/bash | |
/usr/bin/osascript - $1 2>/dev/null << EOF | |
on run argv | |
set newpath to (do shell script "echo $PATH") | |
set path_cd to "" | |
repeat with n from 1 to count of argv | |
set path_cd to path_cd & item n of argv & ASCII character (92) & " " | |
end repeat | |
set path_cd to text 1 thru -3 of path_cd | |
tell application "iTerm" | |
activate | |
if (count of windows) is 0 then | |
if (count of windows) is 1 then | |
set newTab to (current tab of first window) | |
else | |
set newTab to (current tab of (create window with default profile)) | |
end if | |
else | |
set newTab to (create tab with default profile) of first window | |
end if | |
tell current session of newTab to write text "cd " & path_cd | |
end tell | |
end run | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment