All Projects → mmlb → yamlfmt

mmlb / yamlfmt

Licence: GPL-3.0 license
A simple opionated yaml formatter that keeps your comments!

Programming Languages

python
139335 projects - #7 most used programming language
Nix
1067 projects

Projects that are alternatives of or similar to yamlfmt

Remarshal
Convert between CBOR, JSON, MessagePack, TOML, and YAML
Stars: ✭ 421 (+1459.26%)
Mutual labels:  yaml, utility
Swaggen
OpenAPI/Swagger 3.0 Parser and Swift code generator
Stars: ✭ 385 (+1325.93%)
Mutual labels:  yaml, formatter
Pretty Yaml
PyYAML-based module to produce pretty and readable YAML-serialized data
Stars: ✭ 110 (+307.41%)
Mutual labels:  yaml, formatter
Latexindent.pl
Perl script to add indentation (leading horizontal space) to LaTeX files. It can modify line breaks before, during and after code blocks; it can perform text wrapping and paragraph line break removal. It can also perform string-based and regex-based substitutions/replacements. The script is customisable through its YAML interface.
Stars: ✭ 415 (+1437.04%)
Mutual labels:  yaml, formatter
K2tf
Kubernetes YAML to Terraform HCL converter
Stars: ✭ 477 (+1666.67%)
Mutual labels:  yaml, utility
Prettier
Prettier is an opinionated code formatter.
Stars: ✭ 41,411 (+153274.07%)
Mutual labels:  yaml, formatter
bafi
Universal JSON, BSON, YAML, CSV, XML converter with templates
Stars: ✭ 65 (+140.74%)
Mutual labels:  yaml, formatter
scout
Reading and writing in JSON, Plist, YAML and XML data made simple when the data format is not known at build time. Swift library and command-line tool.
Stars: ✭ 110 (+307.41%)
Mutual labels:  yaml
rufo-vim
Ruby format for vim via rufo
Stars: ✭ 52 (+92.59%)
Mutual labels:  formatter
getify
A utility to grab nested values from objects.
Stars: ✭ 12 (-55.56%)
Mutual labels:  utility
character
tool for character manipulations
Stars: ✭ 26 (-3.7%)
Mutual labels:  utility
flutter plus
Develop applications in Flutter more quickly and easily. Customize Containers, Buttons, Texts and TextFields in a few lines. Navigate between Screens and open BottomSheets, Dialogs and Snackbars without context from any point.
Stars: ✭ 17 (-37.04%)
Mutual labels:  yaml
shorted-theme
Shorted theme references for Styled Components.
Stars: ✭ 13 (-51.85%)
Mutual labels:  utility
assign-one-project-github-action
Automatically add an issue or pull request to specific GitHub Project(s) when you create and/or label them.
Stars: ✭ 140 (+418.52%)
Mutual labels:  utility
parse it
A python library for parsing multiple types of config files, envvars & command line arguments that takes the headache out of setting app configurations.
Stars: ✭ 86 (+218.52%)
Mutual labels:  yaml
monoreaper
🌱 Create a monorepo by merging multiple github repositories
Stars: ✭ 21 (-22.22%)
Mutual labels:  utility
TycotBot
TycotBot
Stars: ✭ 24 (-11.11%)
Mutual labels:  utility
Countdown
A friendly disk usage counter for macOS
Stars: ✭ 28 (+3.7%)
Mutual labels:  utility
tdiff
CLI tool for comparing tree like structures
Stars: ✭ 20 (-25.93%)
Mutual labels:  yaml
iterative
Functions for working with iterators in JavaScript and TypeScript
Stars: ✭ 16 (-40.74%)
Mutual labels:  utility

yamlfmt

A simple opionated yaml formatter that keeps your comments!

yamlfmt is just a cli wrapper around the ruamel.yaml python library, which happens to have the unique quality of keeping comments.

Usage

Note: The formatting used is subject to change without notice. Once a format seems to stick v1.0 will be tagged and the format will not change.

❯ yamlfmt -h
usage: yamlfmt [-h] [-w] [file [file ...]]

positional arguments:
  file         file to parse

optional arguments:
  -h, --help   show this help message and exit
  -w, --write  write formatted outpout to (source) file instead of stdout

Examples

Lets see yamlfmt in action:

Simple example from ruamel.yaml docs

❯ yamlfmt <<EOF
# example
name:
  # details
  family: Smith   # very common
  given: Alice    # one of the siblings
EOF
# example
name:
  # details
  family: Smith   # very common
  given: Alice    # one of the siblings

Travis-CI nodejs example

❯ yamlfmt <<EOF
language: node_js

# test on two node.js versions: 0.6 and 0.8
node_js:
  - 0.6
  - 0.8

# configure notifications (email, IRC, campfire etc)
# please update this section to your needs!
notifications:
  irc: "irc.freenode.org#travis"
EOF
language: node_js

# test on two node.js versions: 0.6 and 0.8
node_js:
- 0.6
- 0.8

# configure notifications (email, IRC, campfire etc)
# please update this section to your needs!
notifications:
  irc: irc.freenode.org#travis

Complex example from ruamel.yaml docs

❯ yamlfmt <<EOF
- &CENTER {x: 1, y: 2}
- &LEFT {x: 0, y: 2}
- &BIG {r: 10}
- &SMALL {r: 1}
# All the following maps are equal:
# Explicit keys
- x: 1
  y: 2
  r: 10
  label: center/big
# Merge one map
- <<: *CENTER
  r: 10
  label: center/big
# Merge multiple maps
- <<: [*CENTER, *BIG]
  label: center/big
# Override
- <<: [*BIG, *LEFT, *SMALL]
  x: 1
  label: center/big
EOF
- &CENTER {x: 1, y: 2}
- &LEFT {x: 0, y: 2}
- &BIG {r: 10}
- &SMALL {r: 1}
# All the following maps are equal:
# Explicit keys
- x: 1
  y: 2
  r: 10
  label: center/big
# Merge one map
- <<: *CENTER
  r: 10
  label: center/big
# Merge multiple maps
- <<: [*CENTER, *BIG]
  label: center/big
# Override
- <<: [*BIG, *LEFT, *SMALL]
  x: 1
  label: center/big
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].