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
feat: added a custom writer for all text printers #324
feat: added a custom writer for all text printers #324
Conversation
fd47a90
to
1070040
Compare
Hi @Brookke, just a quick info: The snapshot testing is currently behaving a little weird, so the Build action will most likely always fail. If your local test runs succeed, it's fine. I will fix the tests for this PR when you're ready :) |
Seeing a similar snapshot failure locally too, so I will try and get that sorted |
Codecov Report
@@ Coverage Diff @@
## master #324 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 23 23
Lines 1473 1505 +32
=========================================
+ Hits 1473 1505 +32
Continue to review full report at Codecov.
|
@MarvinJWendt When you get a moment in the next few days mind giving this a partial review. What this PR does is builds upon Florians previous work, however rather than setting a default If you are happy with this approach I will then move on to start writing tests for each of the new WithCustomWriter functions. The only thing I am not super confident about are the writer check lines here: https://github.com/pterm/pterm/pull/324/files#diff-a771b53b10418ad32cd676b8f07bed1b1bd9bbc7ee430bec4b7172c0de679e61R109 however I will try to do some local testing on these to see if this works as expected. |
upon second thoughts I remember we said I'd deal with this in a second PR so I will remove the LivePrinters ability to use a custom writer |
I will review this shorty! |
Snapshot testing is now removed. Note: if you use any JetBrains IDE (IntelliJ IDEA, GoLand, etc.) you should commit and push your changes before pulling master into your branch, as we also removed the |
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.
Looks very good! I have noted a small change (rename WithCustomWriter
to WithWriter
), but that's all. Awesome work, thanks a lot!
Oh one small thing, when you're done, please also update the docs for https://pterm.sh by editing /docs/printers/*
. Just append the new functions to the list, that should be enough!
// Print formats using the default formats for its operands and writes to standard output. | ||
// Print formats using the default formats for its operands and writes to provided writer. |
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.
Nice catch!
For what it's worth I thought the snapshot testing had some value as it did catch some of the issues I had, and they did run locally and pass for me. The main issue I had with them is that they would keep creating snapshot files each time I ran then and I would have to clear those between tests. |
In a few cases PTerm renders different output in the CI systems than locally, which has caused just about every CI run to fail. I am planning a bigger refactor, we'll probably add it back then! |
Hi @Brookke, is the PR ready for review? If so, please mark it as "Ready for review" :) |
Sorry haven't added any tests yet, let me try and get those sorted tomorrow! |
6dc4bf2
to
28fd8c1
Compare
dc5ead7
to
bcf821b
Compare
bcf821b
to
48050e3
Compare
Okay should be good to go now |
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.
Description | Passed |
---|---|
Every WithXXX(...) function returns a pointer of the parent struct. |
YES |
Test contains nil check. | YES |
Printers implement the right interface. | YES |
Variable and function names describe what they do. | YES |
Printer contains theme support. | N/A |
Styles in structs must be pointers. | N/A |
Printer tests uses correct test template. | YES |
Commit messages follow conventional commit style. If NO -> Squash |
NO |
Possible errors are declared in the errors.go file. |
N/A |
Theme styles do not return pointers | N/A |
Documentation in ./docs is updated correctly. |
YES |
Looks very good! Huge thanks for the contribution! I am currently doing some tests with it locally. If everything works as expected (I highly doubt it won't), it will be released today! I also gave you the contributor role in our Discord 😉 |
Hi @Brookke, sorry the release will be a little delayed. GitHub Pages won't build, and after talking to the GitHub Support, it seems that they're having issues. As soon as the docs site is up, the release will be made! |
Thank you! No rush |
Released in v0.12.40! 🚀 |
Description
Add custom writer support for most of the printers except for the area_printer
Scope
Related Issue
Fixes #261
To-Do Checklist