-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from stuart-warren/docs
docs: update docs to include usage
- Loading branch information
Showing
1 changed file
with
13 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |