Commit 973c92cd authored by Ash Furrow's avatar Ash Furrow Committed by Marc Cornellà
Browse files

Adds option for directory to Xcode xc function. (#5253)

parent f39dcfda
...@@ -26,7 +26,7 @@ plugins=(... xcode) ...@@ -26,7 +26,7 @@ plugins=(... xcode)
### `xc` ### `xc`
Opens the current directory in Xcode as an Xcode project. This will open one of the `.xcworkspace` and `.xcodeproj` files that it can find in the current working directory. Opens the current directory in Xcode as an Xcode project. This will open one of the `.xcworkspace` and `.xcodeproj` files that it can find in the current working directory. You can also specify a directory to look in for the Xcode files.
Returns 1 if it didn't find any relevant files. Returns 1 if it didn't find any relevant files.
### `simulator` ### `simulator`
......
...@@ -7,10 +7,19 @@ alias xcsel='sudo xcode-select --switch' ...@@ -7,10 +7,19 @@ alias xcsel='sudo xcode-select --switch'
# source: http://gist.github.com/subdigital/5420709 # source: http://gist.github.com/subdigital/5420709
function xc { function xc {
local xcode_proj local xcode_proj
if [[ $# == 0 ]]; then
xcode_proj=(*.{xcworkspace,xcodeproj}(N)) xcode_proj=(*.{xcworkspace,xcodeproj}(N))
else
xcode_proj=($1/*.{xcworkspace,xcodeproj}(N))
fi
if [[ ${#xcode_proj} -eq 0 ]]; then if [[ ${#xcode_proj} -eq 0 ]]; then
if [[ $# == 0 ]]; then
echo "No xcworkspace/xcodeproj file found in the current directory." echo "No xcworkspace/xcodeproj file found in the current directory."
else
echo "No xcworkspace/xcodeproj file found in $1."
fi
return 1 return 1
else else
echo "Found ${xcode_proj[1]}" echo "Found ${xcode_proj[1]}"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment