gpt4 book ai didi

使用 Xcode 设置 SwiftLint

转载 作者:行者123 更新时间:2023-11-30 10:32:55 26 4
gpt4 key购买 nike

我在 Xcode 上使用的设置为 SwiftLint 运行以下脚本

if which $PATH/swiftlint >/dev/null; then
$PATH/swiftlint
elif which $HOME/.brew/bin/swiftlint >/dev/null; then
$HOME/.brew/bin/swiftlint
elif which ~/Softwares/homebrew/bin/swiftlint >/dev/null; then
~/Softwares/homebrew/bin/swiftlint
else
echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
fi

我无法使用pods或brew。

为了使 SwiftLint 可用,我使用以下命令将以下内容添加到我的路径中vim ~/.bash_profile

export PATH
export PATH=$PATH:/Users/me/Documents/SwiftLint

我现在可以通过命令行在任何地方访问 SwiftLint

但是,Xcode 仍然显示未安装 SwiftLint 的消息。

我无法使用其他方法来安装 Swiftlint 或更改脚本。我猜我的导出路径有问题 - 这是什么问题?

最佳答案

运行脚本时,将不考虑.bash_profile。我会像这样添加你的脚本:

if test -d "${HOME}/Documents/SwiftLint"; then
PATH="${HOME}/Documents/SwiftLint:${PATH}"
fi

export PATH

if ! which swiftlint >/dev/null 2>&1; then
echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint" >&2
fi

关于使用 Xcode 设置 SwiftLint,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58741453/

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