Command reference

Usage: mago format [OPTIONS] [PATH]...

mago fmt is an alias for mago format. Both work.

Global flags must come before format. See the CLI overview for the global list.

Arguments

ArgumentDescription
[PATH]...Files or directories to format. When provided, these replace the paths from mago.toml for this run.
mago fmt src/index.php tests/

Options

FlagDescription
--dry-run, -dPrint a unified diff of the changes that would be made, without writing anything.
--check, -cVerify that every source file is already formatted. Exits 0 on match, 1 if any file would change.
--stdin-input, -iRead source from stdin, format it, print the result to stdout.
--stdin-filepath <PATH>Logical path of the stdin buffer. Requires --stdin-input. Checked against source.excludes and formatter.excludes; if matched, the input is echoed back unchanged. Also replaces <stdin> in diagnostic messages.
--staged, -sFormat only files staged in git and re-stage them. Designed for pre-commit hooks.
-h, --helpPrint help and exit.

↳ Edit this page →