How the three modes of operation work
mainThe yamlfmt command operates in one of three primary modes:
- Format (Default): Collects all matching paths and rewrites each file with the formatted results.
- Dry Run (
-dry): Collects matching paths and runs them through formatting, but instead of writing changes, it prints the formatting diffs to stdout. This mode is affected by the-quietflag. - Lint (
-lint): Collects matching paths and runs them through formatting. If any files have formatting differences, it outputs the diffs to stdout and exits with code1. This mode is also affected by the-quietflag.
Note on Quiet Mode: When using -quiet (or -q) in Dry Run or Lint modes, only the paths of the files with diffs are printed, rather than the full diffs.