mix logos. format
(Logos v0.2.0)
Copy Markdown
Formats Logos source files, or checks that they're already formatted.
Built on Logos.Format, which formats from Ichor's raw token stream
(position- and text-preserving, so comments survive) plus a simple
paren-nesting-depth indentation rule -- --check-formatted mirrors
mix format --check-formatted.
Usage
mix logos.format path/to/file.logos path/to/other.logos
mix logos.format "lib/**/*.logos"
mix logos.format --check-formatted path/to/file.logosEach argument is expanded as a glob (Path.wildcard/1) -- a plain
literal path (no glob metacharacters) still works, since Path.wildcard/1
returns [path] unchanged when path exists and contains no glob
syntax, or [] when it doesn't exist at all (reported as an error,
same as a glob matching nothing).
Without --check-formatted: every matched file is formatted via
Logos.Format.format/1 and written back in place; a file already
exactly formatted is left untouched (no spurious mtime bump) --
determined by comparing bytes before writing.
With --check-formatted: nothing is written. Every matched file is
checked via Logos.Format.formatted?/1; if any file is not already
formatted, their paths are listed and the task exits nonzero (mirrors
mix format --check-formatted's own contract exactly).