简体   繁体   English

从Swift运行命令行工具

[英]Running command line tool from Swift

I want to incorporate a command line tool in my MacOS project in Swift. 我想在Swift的MacOS项目中加入命令行工具。 Basically I'd wish I could just pass the arguments and options in String form just like I would use the tool from a normal command line. 基本上,我希望我可以以字符串形式传递参数和选项,就像我从普通命令行使用该工具一样。 But I have no idea where to actually start. 但是我不知道从哪里开始。 Tips are welcome. 欢迎小费。

就命令行的参数和选项而言,您正在寻找Process类 (在Objective-C中称为NSTask)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM