Skip to content

Latest commit

 

History

22 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

YAML formatting tool, useful for Prometheus rule formatting

Topics

Resources

Stars

9 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages