sindresorhus / project-ideas

Need a JavaScript module or looking for ideas? Welcome ✨
544 stars 9 forks source link

Module to display two streams side-by-side #76

Open sgtlambda opened 8 years ago

sgtlambda commented 8 years ago

Say we are running two processes concurrently, and we want to display the stdout streams of both processes in near(*) realtime. A separator symbol (as wel as other settings such as whether to enable line-wrapping) should be configurable.

$ hub clone sindresorhus/module-requests         | $ hub clone sindresorhus/np
                                                 | 
> Cloning into 'module-requests'...              | > Cloning into 'np'...
> remote: Counting objects: 3, done.             | > remote: Counting objects: 164, done.
> remote: Compressing objects: 100% (2/2), done. | > remote: Total 164 (delta 0), reused 0 (delta 0),
> remote: Total 3 (delta 0), reused 3 (delta 0), |   pack-reused 164
  pack-reused 0                                  | > Receiving objects: 100% (164/164), 430.71 KiB |
> Receiving objects: 100% (3/3), done.           |   0 bytes/s, done.
> Checking connectivity... done.                 | > Resolving deltas: 100% (88/88), done.
                                                 | > Checking connectivity... done.

(*) Some form of a buffer / "debounce" system would be necessary to ensure the side-by-side display of the two streams is optimally efficient and as little "empty lines" as possible are persisted, perhaps log-updatecould be used somehow.

TehShrike commented 8 years ago

How should the two processes be launched? magic-new-thing "hub clone sindresorhus/module-requests" "hub clone sindresorhus/np"?

rreusser commented 8 years ago

Maybe sorta exists but seems a little heavy: https://github.com/arjunmehta/node-columns

Maybe mux(cmd1.stdout, cmd2.stdout) creates a new stream that injects all the escape codes necessary to print in columns and then presumably gets piped to stdout?

Qix- commented 8 years ago

So word of the wise: don't use ANSI escapes. Use ncurses bindings.

parro-it commented 7 years ago

@sgtlambda tThere is also https://github.com/arjunmehta/multiview that seems to fit with your needs...