Format files¶
This guide shows the different ways to feed YAML content to yamkix and control where the formatted output goes.
Check the available options with yamkix --help (or see the CLI options reference).
Format a single yaml file and control where to output the outcome¶
- Use the
-i/--inputoption to identify the source file -
If you don't specify any output option with
-o/--outputor-s/--stdoutthen the result will overwrite the source file -
You can specify the target file with
-o/--output -
You can output the result to STDOUT using either
--output STDOUTor-s/--stdout -
If you use
-s/--stdoutand-i/--input, specifying an output file with-o/--outputwill not be taken into account
Read from STDIN¶
- You can format the input provide through
stdin -
stdininput can be specified explicitly, using--input STDIN -
stdininput is implicit if you don't specify any input through-i/--inputor any CLI argument: -
if
stdinis used for input and nothing is specified for output, thenstdoutwill be used for output.
Format multiple files¶
-
If you need to format multiple files in a single call to
Yamkix, don't use-i/--input, just pass the list of files as arguments to theyamkixcli
Note
It is not possible to output to stdout when formatting multiple files (feel free to raise an issue if you are interested in this feature).
Print a processing summary¶
- Use
--summaryto print processing statistics after all files have been processed - The summary includes:
- Total number of files processed
- Number of files that encountered parse errors
- Number of files with unchanged content (already properly formatted)
-
Total processing time
-
When combined with
--silent(which suppresses per-file config output), only the summary is printed to stderr: