diff --git a/main.coffee b/main.coffee index 1b507af..b2c7f05 100644 --- a/main.coffee +++ b/main.coffee @@ -196,7 +196,21 @@ init = (projName) -> else message - process.exit 1 + +openXcode = (name) -> + try + execSync "open iOS/iOS/#{name}.xcworkspace", stdio: 'ignore' + catch {message} + logErr \ + if message.match /ENOENT/i + """ + Cannot find #{name}.xcworkspace in iOS/iOS. + Run this command from your project's root directory. + """ + else if message.match /EACCES/i + "Invalid permissions for opening #{name}.xcworkspace in iOS/iOS" + else + message cli.version '0.0.4' @@ -213,5 +227,10 @@ cli.command 'init ' init name +cli.command 'xcode' + .description 'Open Xcode project' + .action -> + openXcode readConfig().name + cli.parse process.argv