LoginSignup
3
2

More than 5 years have passed since last update.

Xcode のプロジェクトをよしなに開いてくれるスクリプト

Posted at

小ネタですが

xcode のプロジェクトをターミナルから開くことが良くあって、
その際に $ open Project.x[Tab] って補完しようとしても *.xcworkspace*.xcodeproj が両方あると $ open Project.xc で止まっちゃってムキーってなることが割とよくありまして、
というか今時 xcworkspace が無い方が珍しいのではと思うので大体ムキーとなるわけで、
簡単なスクリプトを書いて対応していたのでした。

#!/usr/bin/env ruby

def try_open(pattern:)
  match = Dir[pattern].first
  match && `open #{match}`
end

try_open(pattern: '*.xcworkspace') || try_open(pattern: '*.xcodeproj')

これで、対象のディレクトリにいって $ openxcode[Enter] で大体オッケーで幸せです。

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2