changelog
changelog copied to clipboard
Add a latest command that shows the latest released version
I wanted a way to get the latest released version number out of my CHANGELOG.md
I hope this is useful!
I've test-driven the changes, so hopefully it should all be good for any refactoring.
I did consider adding this as a default to the show command if you didn't specify a version to show, but that command doesn't actually show the version number, which is what I need.
This does allow you to do changelog show `changelog latest` to show the details of the latest release.
Note that this is my first Go code, so:
a) please be gentle with your feedback b) thanks for writing such an easy-to-navigate codebase that I could learn from and so easily contribute to!
@mattwynne Thanks for your contribution - really good! Just one minor comment - if you could move that logic out of the command it would be great and then I think we are ready to merge
Edit: just authorized the checks and it seems some of them failed - do you mind checking, please?
Thanks for taking a look @rcmachado and sorry for the lag - my GitHub notifications were going into a folder I don't look in very often.
I'm a bit confused by the check failures. The lint task shows golangci-lint found no issues so I'm not sure why that counts a failure.
The goreleaser error looks like maybe their manifest format has changed between versions of goreleaser? The error says:
line 13: field builds not found in type config.Docker
line 15: field binaries not found in type config.Docker
@rcmachado I'd appreciate some help with the linter / goreleaser warnings if you can spare the time. I'm a bit stuck understanding their feedback.
I think it would be more unix'y (i.e. versatile) if this were refactored to a list command that lists all releases. That would be a command that can be used for a lot more. The output could be piped to grep, head, tail, cut etc to extract a particular release.
Suggested output from changelog list (TSV):
Unreleased\t\thttp://example.com/1.0.0..HEAD\t
1.0.0\t2018-04-23\thttp://example.com/abcdef..1.0.0\ttrue
The column headers would not be printed (just like ls -al doesn't print the column headers), but they would be:
Name\tDate\nLink\nYanked
I thought about this some more, and implemented #78 which adds a --json option to fmt and show. That makes it easy to get the latest version (and more) by piping to jq.
WDYT?
I think a list that just listed all the versions could be useful - you could then use show to look at a particular one.
The JSON output seems like a great idea to me, very versatile! Can we have both!?
@mattwynne we don't need a new list command. The fmt --json command lists the entire changelog as JSON. See the example in #78
@mattwyne sorry for the delay - time has been a scarce resource lately.
About CI process failing, couldn't take a look yet but could be something related to tools been updated and rules changed? I don't build this project since some time
Any news on this? I would like to see this.
Hey @tburschka. We have this implemented in our fork: https://github.com/cucumber/changelog