How to use Yamkix
Standalone
- Just use
yamkix
like 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/--input
option to identify the source file -
If you don't specify any output option with
-o/--output
or-s/--stdout
then 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 STDOUT
or-s/--stdout
-
If you use
-s/--stdout
and-i/--input
, specifying an output file with-o/--output
will not be taken into account
Reading from STDIN
- You can format the input provide through
stdin
-
stdin
input can be specified explicitly, using--input STDIN
-
stdin
input is implicit if you don't specify any input through-i/--input
or any CLI argument: -
if
stdin
is used for input and nothing is specified for output, thenstdout
will 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 theyamkix
cli
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 useyamkix
as a pre-commit hook: -
you can pass options to
yamkix
through theargs
key: -
you can control which files will be parsed with the
exclude
key:
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 yamkix
if you are not using uv) -
Sample vscode task :