Skip to content

Instantly share code, notes, and snippets.

@amoblin
Created June 8, 2016 10:55
Show Gist options
  • Save amoblin/8dfed4ce5429d40a10c199bdf4807bc9 to your computer and use it in GitHub Desktop.
Save amoblin/8dfed4ce5429d40a10c199bdf4807bc9 to your computer and use it in GitHub Desktop.
open Xcode project in terminal quickly
#!/bin/sh
# file name: xo.sh
# description: open xcode project in terminal quickly
# create date: 2016-06-08 17:49:45
# author: amoblin
# This file is created by Marboo<http://marboo.io> template file $MARBOO_HOME/.media/starts/default.sh
# 本文件由 Marboo<http://marboo.io> 模板文件 $MARBOO_HOME/.media/starts/default.sh 创建
#name=`basename "$1"`
#name_without_extension=`echo ${name%.*}`
workspace=`find "$1" -name "*.xcworkspace"|grep -v "project.xcworkspace\|Carthage"|head -1`
LEN=$(echo ${#workspace})
#echo ${LEN}
if [ $LEN -gt 0 ]; then
echo will open ${workspace}
open ${workspace}
exit
fi
xcodeproj=`find "$1" -name "*.xcodeproj"|grep -v "Pods.xcodeproj\|Carthage"|head -1`
LEN=$(echo ${#xcodeproj})
#echo ${LEN}
if [ $LEN -gt 0 ]; then
echo will open ${xcodeproj}
open ${xcodeproj}
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment