scriv icon indicating copy to clipboard operation
scriv copied to clipboard

Add a `print` subcommand

Open kurtmckee opened this issue 9 months ago • 3 comments

This introduces a print subcommand that can generate a changelog entry from fragments (similar to collect) or extract an existing entry from the changelog by specifying a --version.

To accommodate environments that do not support output redirection (like tox), an --output argument can be used to write directly to a file. Platform-specific newlines are used by default, but if the changelog is read then its newlines are respected when writing the new file.

Tests and documentation are added, and make botedits was run. Note that it was necessary to modify the CLI runner, which was incorrectly mixing STDOUT and STDERR streams and was adding additional newlines to the output.

Closes #115

kurtmckee avatar Mar 11 '25 14:03 kurtmckee

BTW, another process tweak: once people have started commenting on a pull request, it's better to not force-push. That way, they can see the incremental changes. We'll squash when all the work is done anyway.

nedbat avatar Mar 14 '25 12:03 nedbat

(though i see I hadn't commented here yet!)

I thought that print and collect would have more code in common that could perhaps be refactored somewhere, but maybe not. I have to take a closer look at this later.

Thanks for doing this!

nedbat avatar Mar 14 '25 12:03 nedbat

once people have started commenting on a pull request, it's better to not force-push. That way, they can see the incremental changes

I think I usually follow this when a public PR has started to receive feedback. However, in all cases GitHub offers diffs between force-pushes, which can be accessed via the "Compare" link next to the history entry:

image

All of the feedback you've left so far can be applied directly using GitHub's batch commit interface. Let me know when you're finished reviewing and I'll commit all the suggestions! 👍

kurtmckee avatar Mar 14 '25 12:03 kurtmckee

The print command is missing some coverage:

Name                  Stmts   Miss Branch BrPart   Cover   Missing
------------------------------------------------------------------
src/scriv/print.py       43      5     12      4  83.64%   46-47, 56, 58->54, 62-63

Do you want to add more testing?

nedbat avatar Mar 19 '25 13:03 nedbat

Goodness, yep, I want to tighten that up. I'll bring that up to 100% after hours.

kurtmckee avatar Mar 19 '25 14:03 kurtmckee

Thanks!!

nedbat avatar Mar 24 '25 09:03 nedbat

This is now released as part of scriv 1.6.0.

nedbat avatar Mar 24 '25 11:03 nedbat