Skip to content

Latest commit

 

History

History
80 lines (60 loc) · 1.4 KB

README.md

File metadata and controls

80 lines (60 loc) · 1.4 KB

yamlfmt

Build Status yamlfmt

Get it from the Snap Store

Formats yaml files.

Install

Linux:

sudo snap install yamlfmt

Brew

brew install devopyio/yamlfmt/yamlfmt

Windows

scoop bucket add yamlfmt https://github.com/devopyio/scoop-yamlfmt
scoop install yamlfmt

Using go get

go get -u github.com/devopyio/yamlfmt

Usage

cat example.yaml | yamlfmt

Or you can simply execute:

yamlfmt -filename example.yaml

Example:

"groups": 
- "name": "etcd"
  "rules": 
  - "alert": "EtcdInsufficientMembers"
    "annotations": 
      "message": "Etcd cluster \"{{ $labels.job }}\": insufficient members ({{ $value }})."
    "expr": |
      count(up{job="etcd"} == 0) by (job) > (count(up{job="etcd"}) by (job) / 2 - 1)
    "for": "3m"
    "labels": 
      "severity": "critical"

Becomes:

groups:
- name: etcd
  rules:
  - alert: EtcdInsufficientMembers
    annotations:
      message: 'Etcd cluster "{{ $labels.job }}": insufficient members ({{ $value
        }}).'
    expr: |
      count(up{job="etcd"} == 0) by (job) > (count(up{job="etcd"}) by (job) / 2 - 1)
    for: 3m
    labels:
      severity: critical