[zsh] Open xcodeproj and xcworkspace files by looking for the currently selected Xcode

This commit is contained in:
Eryn Wells 2022-01-25 17:22:41 -08:00
parent 03a6f10522
commit de14a7c00d

View file

@ -37,5 +37,14 @@ function finder {
open -R "$1"
}
function open-xcode {
local selectedXcode=`xcode-select -p`
while [[ ! `basename $selectedXcode` =~ ".app$" ]]; do
selectedXcode=`dirname "$selectedXcode"`
done
open -a "$selectedXcode" $@
}
alias -s app='open'
alias -s xcodeproj='open -a Xcode'
alias -s xcodeproj='open-xcode'
alias -s xcworkspace='open-xcode'