Comments (4)
+1
from tty-table.
Hi Michael,
I would really appreciate contribution from your side, even discussion of the api would be a huge step forward. Since you would like this feature implemented I assume you have an idea of how it should work.
I haven't spent much time thinking about the implementation but using my UML skills, this is what I believe the implemntation should behave like:
Currently TTY::Table
is just a data structure with fairly elaborate way of rendering that data set back as formatted string. There is no notion of stream or partial rendering. Based on the above, we would need to have a way to inject a stream to table, keep it open when the data starts streaming, continue sending messages back to the stream and close it once done. The hard part is to write good api for that, for starters I would suggest the following:
table = TTY::Table.new(stream: 'some stream type such as stdout or file descriptor')
table.on_open do |stream, header|
stream.puts header
end
table.on_receive_data do |stream, formatted_data_rows|
stream.puts formatted_data_rows
end
table.on_close do |stream, footer|
stream.puts footer
stream.close
end
table.render_to_stream
# initial few data rows
table.chunk data
# some time later add few more rows
table.chunk data
Please let me have your thoughts!
from tty-table.
I've stumbled across this project in hope of achieving exactly what Peter has described above.
I'd be interested in any feedback or direction you could provide on how this can be achieved using TTY::Table.
Thanks in advance.
from tty-table.
@moortimis This hasn't been implemented yet in this library. I was hoping for discussion and review of my initial thoughts. Do you have an example of how you would like the streaming API to work? Would you mind commenting on my outline?
from tty-table.
Related Issues (20)
- README Filter test code HOT 1
- Rotated table missing line separator HOT 3
- Dependency conflict with tty-prompt `necromancer` HOT 2
- Headless table fails HOT 1
- CSV/JSON/YAML renderers would be nice HOT 1
- How to disable rotating? HOT 1
- border.separator = :each_row HOT 6
- Create table directly from Hash HOT 4
- undefined method `rindex' for nil:NilClass when using resize: true HOT 7
- Multiline render option breaks multi coloured cell data HOT 4
- anyway to add a separator between arbitrary rows? HOT 2
- Dependency conflict on necromancer 0.4.0, tty-screen 0.6.4 HOT 1
- Strange separator inserting
- Please release version with pastel 0.8 dependency HOT 1
- Columns are not rendered when the table width exceeds the currently set width.Defaulting HOT 1
- table.render outputs nothing when used inside Thor HOT 1
- Support for column spanning HOT 2
- Wrong table header width when using TTY::Link
- RangeError: Invalid array length HOT 1
- Top border is not indented correctly when table has no headers HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tty-table.