gpt4 book ai didi

xcode - 将 TODO 注释显示为警告,不包括 Pods 文件夹

转载 作者:行者123 更新时间:2023-11-29 08:53:23 28 4
gpt4 key购买 nike

我有一个脚本来显示我所有的 //TODO: 评论,如下所示:

KEYWORDS="TODO:|FIXME:|\?\?\?:|\!\!\!:"

find "${SRCROOT}" \( -name "*.h" -or -name "*.m" -or -name "*.swift" \) -print0 |
xargs -0 egrep --with-filename --line-number --only-matching "($KEYWORDS).*\$" |
perl -p -e "s/($KEYWORDS)/ warning: \$1/"

我想排除我的 Pods 文件夹,因此我添加了 -not -path "./Pods/*":

find "${SRCROOT}" \( -name "*.h" -or -name "*.m" -or -name "*.swift" \) -not -path "./Pods/*" -print0 | 
xargs -0 egrep --with-filename --line-number --only-matching "($KEYWORDS).*\$" |
perl -p -e "s/($KEYWORDS)/ warning: \$1/"

当我在终端上尝试时,它按预期工作(将 "${SRCROOT}" 替换为 "."),但是当它由 Xcode 运行时它也使用 Pods 文件夹。

如何在构建阶段脚本中排除文件夹?

最终版本

这似乎可行:

KEYWORDS="TODO:|FIXME:|\?\?\?:|\!\!\!:"
find "." \( -name "*.h" -or -name "*.m" -or -name "*.swift" \) -not -path "./Pods/*" -print0 |
xargs -0 egrep --with-filename --line-number --only-matching "($KEYWORDS).*\$" |
perl -p -e "s/($KEYWORDS)/ warning: \$1/"

最佳答案

我会使用find . 并将构建脚本的工作目录 设置为${SRCROOT}。这应该允许 -not -path "./Pods/*" 中的 .find 有意义。

关于xcode - 将 TODO 注释显示为警告,不包括 Pods 文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37157027/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com