Why?
Because I like my yaml file to be nicely formatted
Because https://marketplace.visualstudio.com/items?itemName=adamvoss.yaml creates (valid) yaml not compatible for kubernetes (and I mainly edit yaml files for kubernetes)
Because https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml does not add explicit start of documents and I don’t like it this way
Because I’m not a js/typescript dev so I don’t want to go into a VSCode extension with client and server language
What?
> ./yamkix -h
usage: yamkix [-h] -i INPUT [-t TYP] [-o OUTPUT] [-n] [-e] [-q] [-f] [-d]
Format yaml input file. By default, explicit_start is `On`, explicit_end is
`Off` and array elements are pushed inwards the start of the matching
sequence. Comments are preserved thanks to default parsing mode `rt`.
optional arguments:
-h, --help show this help message and exit
-i INPUT, --input INPUT
the file to parse
-t TYP, --typ TYP the yaml parser mode. Can be `safe` or `rt`
-o OUTPUT, --output OUTPUT
the name of the file to generate (same as input file
if not specied)
-n, --no-explicit-start
by default, explicit start of the yaml doc is `On`,
you can disable it with this option
-e, --explicit-end by default, explicit end of the yaml doc is `Off`, you
can enable it with this option
-q, --no-quotes-preserved
by default, quotes are preserverd you can disable this
with this option
-f, --default-flow-style
enable the default flow style `Off` by default. In
default flow style (with typ=`rt`), maps and lists are
written like json
-d, --no-dash-inwards
by default, dash are pushed inwards use `--no-dash-inwards` to have the dash start at the sequence level
Config
Explicit start of yaml docs by defaut (you can disable it with --no-explicit-start)
Quotes preserved by default (you can disable it with --no-quotes-preserved)
Arrays elements pushed inwards by default (you can disable it with --no-dash-inwards)
Output file is input file by default
Comments preserved by default thanks to ruamel.yaml round_trip mode (you can disable it with --typ safe)
Where does the name ‘yamkix’ come from?
Thanks to http://online-generator.com/name-generator/product-name-generator.php that suggested me zamkix. Just switched the starting z for the y of yaml
Usage
Install the package with pip install --user yamkix
Sample vscode task :
{
"taskName": "format yaml with yamkix",
"type": "shell",
"command": "yamkix --input ${file}",
"group": "build",
"presentation": {
"reveal": "always",
"panel": "shared"
},
"problemMatcher": []
}
Release files for yamkix 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| yamkix-0.1.1-py2.7.egg | Legacy Egg format | - | - | Details |
| yamkix-0.1.1-py2-none-any.whl | Python 2 | none | any | Details |
Total release size: 12.6 kB
Release files / yamkix-0.1.1-py2.7.egg
| Download URL | yamkix-0.1.1-py2.7.egg |
|---|---|
| Size | 4.2 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
6abe68a8751ac35f66d29ed2e689c494b2e03c7719aa0fa0ae8c0aa701c11131
|
|
BLAKE2b-256 checksum How to use checksums |
88cb57a0b0fda58a2cdcc3fa552e82f76404131114bb2777515c3dbab1fc4689
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.31.1 CPython/2.7.15
|
Release files / yamkix-0.1.1-py2-none-any.whl
| Download URL | yamkix-0.1.1-py2-none-any.whl |
|---|---|
| Size | 8.4 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
b9d914706c3d8d0ecbe0ce54695ef1ccdfea2b0a70e046154bdd454aefb49252
|
|
BLAKE2b-256 checksum How to use checksums |
fbc61b3cdde972a4c2ba4be2b3a2bf99ccf27e3b4512d5d914d36e1b0beb9808
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.31.1 CPython/2.7.15
|