Skip to main content

leo fmt

Format Leo source files, automatically formatting all .leo files in your project.

leo fmt

By default, leo fmt formats all .leo files in the src/ directory. There is no output on success.

You can also format specific files or directories:

leo fmt src/main.leo

Check Mode

To check if files are formatted without modifying them, use the --check flag. This prints a colored diff of any unformatted files and exits with code 1 if changes are needed:

leo fmt --check

leo fmt --check

Flags:

--check

-c

Check if files are formatted without modifying them. Prints a diff and exits with code 1 if any files need formatting.

[PATH]...

Files or directories to format. Defaults to the project src/ directory if not specified.