How to use Yamkix¶
Standalone¶
- Just use
yamkixlike any other CLI - Check the available options with
yamkix --help(and have a look at the configuration documentation)
Formatting 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
Reading 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.
Formatting 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).
Pre-commit hook¶
-
Since
v0.12.0, you can now useyamkixas a pre-commit hook: -
you can pass options to
yamkixthrough theargskey: -
you can control which files will be parsed with the
excludekey:
Note
args and exclude are related to the pre-commit framework, not to yamkix.
VSCode Task¶
-
Install the package with
uv tool install yamkix(orpip install --user yamkixif you are not using uv) -
Sample vscode task :