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: Add util functions to create tables from slices of structs #217
Conversation
This makes it easy to print a slice of structs. or a slice of pointers to structs
Codecov Report
@@ Coverage Diff @@
## master #217 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 24 24
Lines 1243 1243
=========================================
Hits 1243 1243 Continue to review full report at Codecov.
|
Hi @tw1nk, thanks for the PR! I really like the feature. For such features, we have a dedicated package named TableFromStructSlice(tablePrinter, structSlice) pterm.TablePrinter // Accepts a customized table printer and adds data to it, then returns it.
DefaultTableFromStructSlice(tablePrinter, structSlice) pterm.TablePrinter // Uses the first method and feeds the default table printer into the first param and returns the table filled with your computed data. Another quick note: You're committing from an email address which seems to be disconnected from your GitHub account. So those commits won't appear on your GitHub profile, and you won't be listed in our "Contributors" section. You can simply add your commit email to your GitHub account to link the commits, but you don't have to. :) |
Thanks will do. You already had a utility method WithCSVReader which was why I added it to the normal table printer. Regarding the email. thanks, i'll do that :D working from home and haven't setup my normal account on the work computer yet. |
Hi @tw1nk, I have refactored the PR a little, and tested it. I would merge it, but could you please change the filename real quick? It has a typo in "from". I will merge it then :) And you don't need to update 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.
LGTM! Thanks for contributing :)
Description
Describe your work here.
This makes it easy to print a slice of structs. or a slice of pointers to structs
Scope
Related Issue
Fixes #
To-Do Checklist