|
3 | 3 | <plist version="1.0"> |
4 | 4 | <dict> |
5 | 5 | <key>AMApplicationBuild</key> |
6 | | - <string>492</string> |
| 6 | + <string>444.42</string> |
7 | 7 | <key>AMApplicationVersion</key> |
8 | | - <string>2.10</string> |
| 8 | + <string>2.9</string> |
9 | 9 | <key>AMDocumentVersion</key> |
10 | 10 | <string>2</string> |
11 | 11 | <key>actions</key> |
|
51 | 51 | <key>ActionParameters</key> |
52 | 52 | <dict> |
53 | 53 | <key>source</key> |
54 | | - <string>on run {input, parameters} tell application "Xcode" set activeDocument to document 1 whose name ends with (word -1 of (get name of window 1)) set activeDocumentPath to path of activeDocument set currentLines to selected paragraph range of activeDocument set startLine to get item 1 of currentLines set endLine to get item 2 of currentLines end tell set repositoryUrl to do shell script "cd $(dirname '" & activeDocumentPath & "'); git remote -v | grep fetch | awk '{print $2}' | sed 's/ssh:\\/\\/git@/https:\\/\\//' | sed 's/git@/https:\\/\\//' | sed 's/com:/com\\//' | sed 's/\\.git//'" set pathToRepositoryDirLocation to do shell script "cd $(dirname '" & activeDocumentPath & "'); git rev-parse --show-toplevel " set activeFilePathInRepository to replace_text(activeDocumentPath, pathToRepositoryDirLocation, "") set currentCommit to do shell script "cd $(dirname '" & activeDocumentPath & "'); git rev-parse HEAD" set githubUrl to repositoryUrl & "/blob/" & currentCommit & activeFilePathInRepository & "#L" & startLine & "-L" & endLine set the clipboard to replace_text(githubUrl, " ", "%20") return inputend runon replace_text(this_text, search_string, replacement_string) set prevTIDs to AppleScript's text item delimiters set AppleScript's text item delimiters to the search_string set the item_list to every text item of this_text set AppleScript's text item delimiters to the replacement_string set this_text to the item_list as string set AppleScript's text item delimiters to prevTIDs return this_textend replace_text</string> |
| 54 | + <string>on run {input, parameters} |
| 55 | + tell application "Xcode" |
| 56 | + set activeDocument to document 1 whose name ends with (word -1 of (get name of window 1)) |
| 57 | + set activeDocumentPath to path of activeDocument |
| 58 | + set currentLines to selected paragraph range of activeDocument |
| 59 | + set startLine to get item 1 of currentLines |
| 60 | + set endLine to get item 2 of currentLines |
| 61 | + end tell |
| 62 | + |
| 63 | + set repositoryUrl to do shell script "cd \"$(dirname '" & activeDocumentPath & "')\"; git remote -v | grep fetch | awk '{print $2}' | sed 's/ssh:\\/\\/git@/https:\\/\\//' | sed 's/git@/https:\\/\\//' | sed 's/com:/com\\//' | sed 's/\\.git//'" |
| 64 | + |
| 65 | + set pathToRepositoryDirLocation to do shell script "cd \"$(dirname '" & activeDocumentPath & "')\"; git rev-parse --show-toplevel " |
| 66 | + |
| 67 | + set activeFilePathInRepository to replace_text(activeDocumentPath, pathToRepositoryDirLocation, "") |
| 68 | + |
| 69 | + set currentCommit to do shell script "cd \"$(dirname '" & activeDocumentPath & "')\"; git rev-parse HEAD" |
| 70 | + |
| 71 | + set githubUrl to repositoryUrl & "/blob/" & currentCommit & activeFilePathInRepository & "#L" & startLine & "-L" & endLine |
| 72 | + |
| 73 | + set the clipboard to replace_text(githubUrl, " ", "%20") |
| 74 | + |
| 75 | + return input |
| 76 | +end run |
| 77 | + |
| 78 | +on replace_text(this_text, search_string, replacement_string) |
| 79 | + set prevTIDs to AppleScript's text item delimiters |
| 80 | + set AppleScript's text item delimiters to the search_string |
| 81 | + set the item_list to every text item of this_text |
| 82 | + set AppleScript's text item delimiters to the replacement_string |
| 83 | + set this_text to the item_list as string |
| 84 | + set AppleScript's text item delimiters to prevTIDs |
| 85 | + return this_text |
| 86 | +end replace_text</string> |
55 | 87 | </dict> |
56 | 88 | <key>BundleIdentifier</key> |
57 | 89 | <string>com.apple.Automator.RunScript</string> |
@@ -105,7 +137,7 @@ end run</string> |
105 | 137 | <key>isViewVisible</key> |
106 | 138 | <true/> |
107 | 139 | <key>location</key> |
108 | | - <string>649.000000:761.000000</string> |
| 140 | + <string>541.500000:805.000000</string> |
109 | 141 | <key>nibPath</key> |
110 | 142 | <string>/System/Library/Automator/Run AppleScript.action/Contents/Resources/Base.lproj/main.nib</string> |
111 | 143 | </dict> |
|
0 commit comments