From de62dceb2b1aca1fc8e8fb56416cdee7f3b48977 Mon Sep 17 00:00:00 2001 From: "stuart.warren" Date: Mon, 30 Sep 2019 15:26:12 +0100 Subject: [PATCH] docs: update docs to include usage --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index bbcd9dc..bf148d2 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,21 @@ # yamlfmt +[![Go build](https://github.com/stuart-warren/yamlfmt/workflows/Go/badge.svg)](https://github.com/stuart-warren/yamlfmt/actions) + based on gofmt, yamlfmt formats yaml files into a canonical format * lists are not indented * maps have sorted keys * indent is 2 spaces * documents always have separators `---` + +``` +$ yamlfmt --help +formats yaml files with 2 space indent, sorted dicts and non-indented lists +usage: yamlfmt [flags] [path ...] + -d display diffs instead of rewriting files + -l list files whose formatting differs from yamlfmt's + -w write result to (source) file instead of stdout +``` + +Without an explicit path, it processes the standard input. Given a file, it operates on that file; given a directory, it operates on all .yaml and .yml files in that directory, recursively. (Files starting with a period are ignored.) By default, yamlfmt prints the reformatted sources to standard output.