changelog
changelog copied to clipboard
Add --check option to fmt
The fmt
command formats and normalizes the changelog file.
But to check if the file is formatted correctly, we need to run something similar to:
diff -u <(changelog fmt -f CHANGELOG.md) CHANGELOG.md
We can simplify this code to:
changelog fmt --check
Which is useful specially for CI environments.
@rcmachado I recently started learning Go I can pick this up. 😄
@Pradhvan That's great :D
Feel free to reach out in case you need anything
@rcmachado sure. 😄 I am looking into cobra and parser.go
at the moment.
@Pradhvan That's a good starting point. parser.go
uses blackfriday to read the markdown file and a set of custom functions to render it.
The challenge is to make sure things like whitespaces and new lines are also considered - for our use case, extra whitespaces and new lines would cause the --check
option to fail. So you'll probably have to take a look and see what's possible on blackfriday.
Obviously, if you have other ideas also feel free to experiment them :)