-
-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add "add" command #47
Conversation
@ordepdev You checked in a binary, you'll want to remove that. |
fun string(): String iso^ => | ||
if heading == _unreleased_heading then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't think you meant to remove all of this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, if we don't remove this, it will print the unrelease thing with an empty body, without the entries that we're adding. That's why I removed it 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this break the "unreleased" command?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "unreleased" release should always show the fixed, added, and changed sections, even if they are empty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect that this is the cause of the CI failure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah!
## [unreleased] - unreleased
### Fixed
### Added
### Changed
It's yielding ## [unreleased] - unreleased
and makes the test fail.
I'm struggling to reach a point where I can print the empty sections only from unlreleased versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out that unreleased sections were being parsed as None
, so I added an extra check for each section saying that if it's unreleased and the section is None
, it will use the Section._empty(....)
for printing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, for the parse test that's failing, a changelog must now contain all sections in "unreleased" because it can no longer assume that the "unreleased" release is either empty or nonexistent. It may be best to create a new class, Unreleased
that uses Section
instead of (Section | None)
as field types. This would be simpler than treating it as any other release at this point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ordepdev would you want to include the changes above in this PR? If not, I can do it after this PR is merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would love to but I think it's better to let you do it and take a look at your changes after!
461fb8c
to
e6835be
Compare
Looks like there is a failing test |
Awesome first-time contribution @ordepdev! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ordepdev! Looks good other than some style-guide-related issues and @SeanTAllen's comments
e6835be
to
632f9af
Compare
changed as Section | ||
else error | ||
end | ||
section.entries.push("- " + entry) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A newline should be added to the end of the entry if it doesn't already have one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be done by using "String.contains" and appending "\n"
or is there other idiomatic way of doing it?
edit_or_print( | ||
filepath, | ||
edit, | ||
Changelog(parse(filepath, filename)?)? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding .> create_unreleased()
here before add_entry
will likely solve the problem. An unreleased section should be created anyway if someone is using this command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, creating a new "unreleased" release creates new empty sections.
changelog-tool new
changelog-tool unreleased -e
changelog-tool add fixed "We fixed some nasty bug." -e
changelog-tool add added "And we added some cool feature." -e
changelog-tool add changed "And changed some little things as well." -e
changelog-tool release 1.0.0
Currently, this works as expected. If I add that command only the last "changed" will be reflected in the file, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the problem is that the "unreleased" release must contain all sections if it exists. Previously the string
function would assume that it is empty if it exists. But this is no longer a reasonable assumption, so the sections must be created if they don't exist. That's why it may be useful to create a new class for unreleased that reflects the requirement that the sections cannot have type None
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, make the types do the work instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, looks good. I'll make a followup PR with some additional changes to how the "unreleased" release is treated.
Nice, thanks for all the help! Will look this closely for changes 🍻 |
The following sequence of commands:
Will result in this nice changelog: