我在 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
Run Code Online (Sandbox Code Playgroud)
我无法使用 pods或酿造。
为了使其SwiftLint可用,我使用 vim 将以下内容添加到我的路径中~/.bash_profile
export PATH
export PATH=$PATH:/Users/me/Documents/SwiftLint
Run Code Online (Sandbox Code Playgroud)
我现在可以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
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1000 次 |
| 最近记录: |