From bcd3a40d896829ac46e9c71a48388ed21a222077 Mon Sep 17 00:00:00 2001 From: zlfyuan <741136856@qq.com> Date: Wed, 16 Dec 2020 16:55:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0xcode=E6=89=93=E5=BC=80?= =?UTF-8?q?=E5=91=BD=E4=BB=A4=E8=A1=8C=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 12 +++++++- xcode_commandline/bin/icode | 52 ++++++++++++++++++++++++++++++++++ xcode_commandline/bin/icode.sh | 52 ++++++++++++++++++++++++++++++++++ 3 files changed, 115 insertions(+), 1 deletion(-) create mode 100755 xcode_commandline/bin/icode create mode 100644 xcode_commandline/bin/icode.sh diff --git a/README.md b/README.md index d68d061..467d313 100644 --- a/README.md +++ b/README.md @@ -1 +1,11 @@ -# iOSNote \ No newline at end of file + +# iOSNote + +# xcode_commadline 支持在终端打开iOS/Mac的项目 diff --git a/xcode_commandline/bin/icode b/xcode_commandline/bin/icode new file mode 100755 index 0000000..3229992 --- /dev/null +++ b/xcode_commandline/bin/icode @@ -0,0 +1,52 @@ +#!/bin/bash + +### + # @Author: zluof + # @Date: 2020-08-17 11:28:45 + # @LastEditTime: 2020-12-16 16:22:11 + # @LastEditors: zluof + # @Description: + # @FilePath: /undefined/Users/zhongxiaoxi/Desktop/testc/testc.sh +### + +root=$1 + +if [ ${#root} -eq 0 ] +then + echo `没有找到项目路径` + exit +else + root=$1 +fi +space="true" +# echo $root +pod_xcodeproj="/Pods/Pods.xcodeproj" +for filename in `find "$root" -name "*.xcodeproj"` +do + # echo $filename + if [[ $filename =~ $pod_xcodeproj ]]; + then + # 打开xcworkspace + # echo $filename + # echo `open *.xcworkspace` + space="true" + else + # 打开xcodeproj + # echo $filename + space="false" + file="$filename" + # echo `open *.xcodeproj` + fi +done +# echo $space +if [ $space == "true" ]; +then + for xcworkspace in `find "$root" -name "*.xcworkspace"` + do + # echo $xcworkspace + file="$xcworkspace" + done + echo `open $file` +else + echo `open $file` +fi \ No newline at end of file diff --git a/xcode_commandline/bin/icode.sh b/xcode_commandline/bin/icode.sh new file mode 100644 index 0000000..3229992 --- /dev/null +++ b/xcode_commandline/bin/icode.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +### + # @Author: zluof + # @Date: 2020-08-17 11:28:45 + # @LastEditTime: 2020-12-16 16:22:11 + # @LastEditors: zluof + # @Description: + # @FilePath: /undefined/Users/zhongxiaoxi/Desktop/testc/testc.sh +### + +root=$1 + +if [ ${#root} -eq 0 ] +then + echo `没有找到项目路径` + exit +else + root=$1 +fi +space="true" +# echo $root +pod_xcodeproj="/Pods/Pods.xcodeproj" +for filename in `find "$root" -name "*.xcodeproj"` +do + # echo $filename + if [[ $filename =~ $pod_xcodeproj ]]; + then + # 打开xcworkspace + # echo $filename + # echo `open *.xcworkspace` + space="true" + else + # 打开xcodeproj + # echo $filename + space="false" + file="$filename" + # echo `open *.xcodeproj` + fi +done +# echo $space +if [ $space == "true" ]; +then + for xcworkspace in `find "$root" -name "*.xcworkspace"` + do + # echo $xcworkspace + file="$xcworkspace" + done + echo `open $file` +else + echo `open $file` +fi \ No newline at end of file