Skip to content

Instantly share code, notes, and snippets.

@veb
Created July 9, 2015 11:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save veb/2721b519f689033a20ef to your computer and use it in GitHub Desktop.
Save veb/2721b519f689033a20ef to your computer and use it in GitHub Desktop.
Highlight Git repos in Finder (for OSX)
set theSearchPath to "/Users/<username>"
set theResults to do shell script "find " & quoted form of theSearchPath & " -name .git ! -perm -g+r,u+r,o+r -prune"
repeat with i from 1 to (count paragraphs of theResults)
set theResult to paragraph i of theResults
set theParentPath to text 1 through ((length of theResult) - 5) of theResult
set theParentAlias to POSIX file (theParentPath) as alias
tell application "Finder"
set label index of theParentAlias to 6
-- Set the last value of the previous line corresponding to label color desired
-- 0 (no color)
-- 1 (orange)
-- 2 (red)
-- 3 (yellow)
-- 4 (blue)
-- 5 (purple)
-- 6 (green)
-- 7 (gray)
end tell
end repeat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment