-
-
Save yiyuanlu/4043635 to your computer and use it in GitHub Desktop.
Applescript to beautify Objc code in Xcode
This file contains 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
tell application "Xcode" | |
if (frontmost of it = false) then | |
return | |
end if | |
set documentList to source document of it | |
set listLength to count of documentList | |
if listLength is less than 1 then | |
return --no opened source file in working space | |
end if | |
set filePath to path of item listLength of documentList -- get the last one | |
set filePathStr to filePath as text | |
if (filePathStr ends with ".m" or filePathStr ends with ".h") then --only format source file | |
do shell script "uncrustify -c ~/.uncrustify/objc.cfg --no-backup " & filePathStr -- where the essense resides.. | |
end if | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment