rich
rich copied to clipboard
Add `echo` param to `Console.capture`
Type of changes
- [ ] Bug fix
- [x] New feature
- [ ] Documentation / docstrings
- [ ] Tests
- [ ] Other
Checklist
- [x] I've run the latest black with default args on new code.
- [x] I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate.
- [x] I've added tests for new code.
- [x] I accept that @willmcgugan may be pedantic in the code review.
Description
Adds echo parameter to the capture method of Console. When True, captured output will also be written to the output file.
Codecov Report
Merging #2347 (3b02ec9) into master (d110847) will decrease coverage by
0.04%. The diff coverage is100.00%.
@@ Coverage Diff @@
## master #2347 +/- ##
==========================================
- Coverage 98.71% 98.66% -0.05%
==========================================
Files 73 72 -1
Lines 7704 7721 +17
==========================================
+ Hits 7605 7618 +13
- Misses 99 103 +4
| Flag | Coverage Δ | |
|---|---|---|
| unittests | 98.66% <100.00%> (-0.05%) |
:arrow_down: |
Flags with carried forward coverage won't be shown. Click here to find out more.
| Impacted Files | Coverage Δ | |
|---|---|---|
| rich/console.py | 98.32% <100.00%> (+0.03%) |
:arrow_up: |
| rich/cells.py | 96.05% <0.00%> (-3.95%) |
:arrow_down: |
| rich/style.py | 99.75% <0.00%> (-0.25%) |
:arrow_down: |
| rich/rule.py | 100.00% <0.00%> (ø) |
|
| rich/_lru_cache.py |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update d110847...3b02ec9. Read the comment docs.
Just wanted to see if echo is the right term or would tee be better?
@nathanrpage97 I agree, I don't think echo is the right term either 🤷♂️ tee has better semantics to me but I had to click the link you provided as I couldn't remember what it was. Could also do something like write_to_terminal defaulted to False.
Yea, I guess it may be a bit esoteric for the general users of the library
@darrenburns Any chance to revive this? The changes introduced by 12.5.1 broke capture support in enrich, https://github.com/pycontribs/enrich/issues/40 and temporary I had to pin-down rich as I would need the echo/tee functionality. Thanks.
@willmcgugan That PR happens to be on xmas wishlist for quite some time. I wonder if Santa is feeling generous these days ;)