Skip to content

Conversation

@mattwynne
Copy link

@mattwynne mattwynne commented Jul 21, 2021

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 added a commit to cucumber/changelog that referenced this pull request Aug 16, 2021
@rcmachado
Copy link
Owner

rcmachado commented Aug 20, 2021

@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?

@mattwynne
Copy link
Author

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 
@mattwynne
Copy link
Author

@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.

@aslakhellesoy
Copy link

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 
@aslakhellesoy
Copy link

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?

@mattwynne
Copy link
Author

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!?

@aslakhellesoy
Copy link

@mattwynne we don't need a new list command. The fmt --json command lists the entire changelog as JSON. See the example in #78

@rcmachado
Copy link
Owner

@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

mattwynne added a commit to cucumber/changelog that referenced this pull request Nov 11, 2021
* Add a latest command that shows the latest released version * Clarify help text * Add another test case and refactor * Update README * Add changelog entry for rcmachado#77 * Move ReleasedVersions onto ChangeLog model * Update CHANGELOG * Fix ref to parser module * Reformat for linter Co-authored-by: Matt Wynne <matt@Matts-MacBook-Pro.local>
@tina-junold
Copy link

Any news on this? I would like to see this.

@mattwynne
Copy link
Author

Hey @tburschka. We have this implemented in our fork: https://github.com/cucumber/changelog

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants