Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

wcl fmt

Format a WCL document according to the standard style.

Usage

wcl fmt <file> [options]

Options

FlagDescription
--writeFormat the file in place instead of printing to stdout
--checkCheck whether the file is already formatted; exit non-zero if not

Description

wcl fmt applies canonical formatting to a WCL document. By default, it prints the formatted output to stdout, leaving the source file unchanged.

The formatter preserves:

  • All comments (line, block, and doc comments)
  • Blank line grouping within blocks
  • The logical structure and ordering of the document

The formatter normalises:

  • Indentation (2 spaces per level)
  • Spacing around operators and delimiters
  • Trailing commas in lists and maps
  • Consistent quote style for string literals

Exit Codes

CodeMeaning
0Success (or file is already formatted when using --check)
1File would be reformatted (only with --check)
2Argument or parse error

Examples

Print formatted output to stdout:

wcl fmt config.wcl

Format file in place:

wcl fmt --write config.wcl

Check formatting in CI (no changes written):

wcl fmt --check config.wcl

Check all WCL files in a project:

find . -name '*.wcl' | xargs wcl fmt --check