Skip to content

Releases: google/yamlfmt

v0.4.0

20 Sep 14:19
f3eff05
Compare
Choose a tag to compare

This release is smaller than the last few. I wanted to get a release out before I go on leave for a bit.

Changes

emoji_support

This is a combination of a fix and a feature; the yaml.v3 library does not properly parse emojis because it cannot properly print 4-byte UTF-8 characters. Hopefully that gets fixed soon, and #41 is open to track that when it happens. While this would be sensible to make a default behaviour, I've opted to default to false because it is a hack around a shortcoming of the upstream library.

retain_line_breaks

When this is enabled, yamlfmt will keep line breaks instead of deleting them. Similar to emoji_support, I would have liked to make this default but because it's a hack around a shortcoming of the library I'm defaulting it to false as well.

Functional Features architecture

This is an improvement to the API of the Basic Formatter, and features improvements to the base yamlfmt package as well. Previously, there were lots of special conditions tacked on before and after formatting in the Format function of the Basic Formatter, and it was becoming increasingly tangled when the needs of the function expanded. This improves the extensibility of the formatter, which allows for "features" to be created and added to be run as hooks before and after yaml formatting. Future formatters that I write in this package will use it. This marks an improvement to folks forking this tool and adding their own functionality in, provides a nicer basis for folks interested in writing their own formatters, and should hopefully make future contribution a lot more straightforward.

Diff improvement

I've made another improvement to the diff readability. The diff now shows side by side, making it far more easy to read. It still needs some more work, however I've separated that work into a new package that I will from here on incrementally improve in my spare time.

stdout output is more convenient

I had used fmt.Println to output to stdout in previous versions. This caused a problem for folks using yamlfmt as an editor integration, since yamlfmt already appends a newline to the formatted yaml. This release swapped to fmt.Print instead.

If you have any problems or suggestions, feel free to make an issue!

Contributors

Thanks to @longkai for the retaining line break feature and the fix to stdout output.

Changelog

  • d9d4189 chore: don't append new line at the end and keep the content as it is (#45)
  • f3eff05 engine: switched to multilinediff package (#47)
  • e05c99f fix #27 retain line break (#42)
  • 9fffda5 fix: line break format issue after refactor code (#44)
  • d9e8674 hotfix: add utf-8 parsint for emoji_support (#40)
  • 6da562a yamlfmt: added and implemented functional features (#43)

v0.3.0

27 Aug 18:22
abc4812
Compare
Choose a tag to compare

Features

  • Can now operate in stdin mode with the Unix pattern of - or /dev/stdin arguments
  • Pass a custom config from another path using the -conf flag

Improvements/Fixes

  • Works with CRLF
    • There are a couple bugs upstream that were causing problems with CRLF behaviour, see #34 and #37 for details
  • Updated help message

Fixes

Changelog

  • 5ad1599 chore: fix indent typo in configuration options (#25)
  • 79e66ea feat: accept - or /dev/stdin instead of -in (#28)
  • fc7dca4 feat: add ability to pass config path (#30)
  • fe69346 feat: improve help message (#32)
  • abc4812 fix: hotfix shim for CRLF behaviour (#36)

v0.2.0

23 Aug 21:29
90fa1be
Compare
Choose a tag to compare

The big features of this release are:

  • Multi-document file support
    • Files with multiple documents separated by --- are now supported and fully formatted
  • include_document_start option added
    • The default formatting behaviour doesn't include the --- at the start of the document, this flag will ensure it's added
  • stdin operation mode
    • With the -in flag, the tool will read from stdin allowing for piping data through | in the CLI
  • Diff readability improved
    • The diff readability is improved, still not as good as it will be eventually but this is a fine bandaid fix

One bug was fixed:

  • Multiple paths in exclude no longer causes every single file to be found

Changelog

  • 79d0e08 basic: Support formatting multi-document files (#19)
  • 80328a4 basic: add include_document_start (#20)
  • fcac9d5 command: add support for formatting from stdin (#18)
  • 28b179f diff: improve diff readability (#17)
  • 90fa1be engine: fix exclude path bug (#21)

v0.1.0

22 Aug 17:51
5522f02
Compare
Choose a tag to compare

Changelog

  • c0bc122 Add missing license header
  • 7b4f2d5 Add support for paths as command line args
  • b15b9d8 Add usage documentation to README, fixed bugs found while writing
  • 6b0aa78 Added missing license header
  • 7451d46 Clean up unimportant test yaml files
  • 7c28387 Delete test config file
  • 69bd749 Formatting and linting all files working
  • 479b4df Initial commit, WIP
  • c5e9087 Restructured project for easier extensibility
  • 39ddc57 Update to yaml.v3 and use yaml.Node (#4)
  • 07d5e88 delete unnecessary 'return err' (#1)
  • 36136ab fill in empty default config fields