这个命令行工具可以检查拼写并显示建议的更正。
我们可以从这里下载二进制文件。
$ git clone git@github.com:ezura/spell-checker-for-swift.git
$ cd spell-checker-for-swift
$ make
$ mint install ezura/spell-checker-for-swift@5.3.0
在与 xcodeproj 文件相同的目录中运行 typokana init
。
要在 Xcode 上显示警告,请将脚本添加到 “Run Script Phase”。
if which typokana >/dev/null; then
typokana --diff-only
else
echo "`typokana` is not installed."
fi
此设置仅在已更改的 swift 文件(通过 git diff
获取)中搜索拼写错误。
如果要选择目标目录,请添加目录路径。
if which typokana >/dev/null; then
typokana /Sources
else
echo "`typokana` is not installed."
fi
准备一个拼写检查器忽略的单词列表。
typokana init
在当前目录中创建 “.typokana_ignore”。
在所有 swift 文件中搜索拼写错误。
当此命令在 “Run Script” 中运行时,在 Xcode 上显示拼写错误的警告。
推荐使用此命令。
仅在已更改的 swift 文件(通过 git diff
获取)中搜索拼写错误。
更改用于拼写检查的语言,例如 “en_US”(默认为使用系统语言)。 (typokana --language en_US
)
(typokana --help
)
OVERVIEW: Spell check
USAGE: typokana [options] argument
OPTIONS:
--diff-only, -diff Check only files listed by `git diff --name-only`
--language, -l The language to use for spell checking, e.g. "en_US" (defaults to using the system language).
--help Display available options
POSITIONAL ARGUMENTS:
path | init Path to target file | set up typokana
例如,如果您不想显示关于 “typokana”、“json” 和 “yuka” 的警告,请在 “.typokana_ignore” 中写入以下文本。
typokana
json
yuka