index rss mastodon twitter github linkedin email
Álvaro Ramírez
sponsor

Álvaro Ramírez

11 May 2019 Building swift-format

Trying out Google's swift-format. Build with:

git clone -b swift-5.2-branch https://github.com/apple/swift-format.git
cd swift-format
swift build
.build/x86_64-apple-macosx/debug/swift-format --help
OVERVIEW: Format or lint Swift source code.

USAGE: swift-format [options] <filename or path> ...

OPTIONS:
  --configuration         The path to a JSON file containing the configuration of the linter/formatter.
  --in-place, -i          Overwrite the current file when formatting ('format' mode only).
  --mode, -m              The mode to run swift-format in. Either 'format', 'lint', or 'dump-configuration'.
  --recursive, -r         Recursively run on '.swift' files in any provided directories.
  --version, -v           Prints the version and exists
  --help                  Display available options

POSITIONAL ARGUMENTS:
  filenames or paths      One or more input filenames

UPDATE: Now uses swift-5.2-branch (for Xcode 11.4), according to Matching swift-format to Your Swift Version.