Skip to main content

An opinionated yaml formatter based on ruamel.yaml, that works fine for k8s descriptors

Project description

# yamkix

## Why?

- Because I like my yaml file to be nicely formatted
- Because <> creates (valid) yaml not compatible for kubernetes (and I mainly edit yaml file for kubernetes)
- Because <> 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' comes from?

- Thanks to <> that suggested me `zamkix`. Just switched the starting `z` for the `y` of `yaml`

## Usage

- Put the `yamkix` file somewhere in the path
- Sample **vscode** task here:

"taskName": "format yaml with yamkix",
"type": "shell",
"command": " --input ${file}",
"group": "build",
"presentation": {
"reveal": "always",
"panel": "shared"
"problemMatcher": []


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for yamkix, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size yamkix-0.1.0-py2.7.egg (4.0 kB) File type Egg Python version 2.7 Upload date Hashes View
Filename, size yamkix-0.1.0-py2-none-any.whl (6.2 kB) File type Wheel Python version py2 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page