gustavnikolaj / jshell

shell interface from nodejs
3 stars 0 forks source link

Pipe stuff into stdin of the first command. #4

Open gustavnikolaj opened 9 years ago

gustavnikolaj commented 9 years ago

Like:

var jsHell = jshell('grep', 'foo');
someGiantLogFileStream.pipe(jsHell.stdin);

jsHell.pipe('grep', 'bar');
sunesimonsen commented 9 years ago

It would work if jshell is a writable stream.

gustavnikolaj commented 9 years ago

I think this looks cleaner and reads better:

var jsHell = jshell();

someGiantLogFileStream.pipe(jsHell.stdin);

jsHell.pipe('grep', 'foo');
jsHell.pipe('grep', 'bar');

But it's shouldn't make a difference.

sunesimonsen commented 9 years ago

I agree, but I think it should be like this:

someGiantLogFileStream.pipe(jshell('grep', 'foo').pipe('grep', 'bar')).log();