Created
February 8, 2018 03:10
-
-
Save GeneralD/68ceca0f2b0719b3aa123630d190b494 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env zsh | |
(){ | |
local plistfile="$HOME/Library/Preferences/com.apple.LaunchServices/com.apple.launchservices.secure.plist" | |
local i=0 | |
while [[ $i != "false" ]]; do | |
[[ `/usr/libexec/PlistBuddy -c "Print :LSHandlers:$i" $plistfile 2>/dev/null` ]] || break | |
ext=`/usr/libexec/PlistBuddy -c "Print :LSHandlers:$i:LSHandlerContentTag" $plistfile 2>/dev/null` | |
app=`/usr/libexec/PlistBuddy -c "Print :LSHandlers:$i:LSHandlerRoleAll" $plistfile 2>/dev/null` | |
[[ $ext =~ ^[a-zA-Z0-9]+$ ]] && [ $app ] \ | |
&& ! alias -s $ext 1>/dev/null && alias -s $ext="open -b ${app}" | |
((i++)) | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment