ios - 有没有可以修改 Podfile 的命令行工具?
问题描述
我想使用 Cocoapods 为我的项目添加一个框架。但我不想手动更改 Podfile。我想使用命令行来编辑 Podfile,如下所示:
some_command ./Podfile --add AFNetworking --target MyTarget
可能吗?
解决方案
不幸的是,没有这样的命令。
您可以做的越近,就是创建一个.sh
打开Podfile
并在其上写入的文件。例子:
podwrite.sh
#!/bin/sh
FILE="Path/To/Podfile"
/bin/cat <<EOM >$FILE
source 'https://github.com/CocoaPods/Specs.git'
target 'MyTarget' do
use_frameworks!
pod 'AFNetworking'
end
EOM
通过终端调用:
sh podwrite.sh
podfile 上的输出:
source 'https://github.com/CocoaPods/Specs.git'
target 'MyTarget' do
use_frameworks!
pod 'AFNetworking'
end
推荐阅读
- java - java.net.HttpURLConnection URL 中 userinfo 的安全隐患
- node.js - 适用于 Windows 7 的 NodeJS
- android - 可以将属性存储在存储库中以供重用吗?
- javascript - 如何获取背景图片的网址
- javascript - 让 useEffect 观察一个条件并让它只触发一次
- python - 我应该使用 html 将 html 页面链接在一起还是 python(flask) 更好
- python - DataFrame 按其他列应用过滤
- java - Java Nio 上的 Kafka 消费者心跳线程块
- java - 如果在java中未达到条件,如何重复语句
- java - 为什么我的 Spring Boot 应用程序中的 Redis 缓存没有变空?