yml-sorter
yml-sorter copied to clipboard
Option to ignoreKeys
Allows excluding keys from sorting, eg. when we need to maintain the visual order for certain keys
Can you elaborate a little more on the use case for this PR with an example?
Actually, realised that my initial strict use case would not be really useful for general cases. However i just slightly modified that pull request into more useful:
In docker compose:
version: '2'
services:
other:
hostname: other
image: some/image
labels:
io.system.global.enabled: false
io.rancher.scheduler.affinity:host_label: zone=private,core=true,cpu=true
io.rancher.service.external_dns: never
io.zeta.service.pattern: MMMS
blah:
hostname: blah
image: some/image
labels:
io.system.global.enabled: false
io.rancher.scheduler.affinity:host_label: zone=private,core=true,cpu=true
io.rancher.service.external_dns: never
io.zeta.service.pattern: MMMS
With new modification:
node index.js --input docker-compose.yml --output sorted.yml --ik version io.
We are able to keep certain things in place which makes it easier to read/compare eg :
- version - stays at the top
- labels: io* eg: io.system.global.enabled etc are kept unsorted
version: '2'
services:
blah:
hostname: blah
image: some/image
labels:
io.system.global.enabled: false
'io.rancher.scheduler.affinity:host_label': 'zone=private,core=true,cpu=true'
io.rancher.service.external_dns: never
io.zeta.service.pattern: MMMS
other:
hostname: other
image: some/image
labels:
io.system.global.enabled: false
'io.rancher.scheduler.affinity:host_label': 'zone=private,core=true,cpu=true'
io.rancher.service.external_dns: never
io.zeta.service.pattern: MMMS